Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Kubernetes, explained by example.

W. Biller
October 27, 2022

Kubernetes, explained by example.

Example 1

apiVersion: v1

kind: Pod
metadata:
name: hello-world
namespace: kassel-code-meetup
labels:
app: hello-world
spec:
containers:
- name: hello-world
image: nginxdemos/hello:0.2
ports:
- name: http
containerPort: 80

Example 2

apiVersion: v1

kind: Service
metadata:
name: hello-world
namespace: kassel-code-meetup
spec:
selector:
app: hello-world
ports:
- name: http
port: 80
targetPort: 80

Example 3

apiVersion: networking.k8s.io/v1

kind: Ingress
metadata:
name: hello-world
namespace: kassel-code-meetup
annotations:
nginx.ingress.kubernetes.io/ssl-redirect: "false"
spec:
ingressClassName: nginx
rules:
- host: hello.biller.cloud
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: hello-world
port:
number: 80

Example 4

apiVersion: apps/v1

kind: ReplicaSet
metadata:
name: hello-world
namespace: kassel-code-meetup
spec:
replicas: 5
selector:
matchLabels:
app: hello-world
template:
metadata:
labels:
app: hello-world
spec:
containers:
- name: hello-world
image: nginxdemos/hello:0.2
ports:
- name: http
containerPort: 80

Example 5

apiVersion: apps/v1

kind: Deployment
metadata:
name: hello-world
namespace: kassel-code-meetup
spec:
replicas: 10
selector:
matchLabels:
app: hello-world
template:
metadata:
labels:
app: hello-world
spec:
containers:
- name: hello-world
image: nginxdemos/hello:0.2
ports:
- name: http
containerPort: 80
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 0
maxUnavailable: 20%

W. Biller

October 27, 2022

Transcript

4 slides

More Decks by W. Biller

Other Decks in Programming