Skip to content

Instantly share code, notes, and snippets.

@jamct
Last active June 6, 2023 13:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save jamct/f75fb87a67987570c0b06b189031859e to your computer and use it in GitHub Desktop.
Save jamct/f75fb87a67987570c0b06b189031859e to your computer and use it in GitHub Desktop.
Beispiele: Kubernetes-Einstieg für Docker-Kenner
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-first-nginx-deployment
labels:
app: my-nginx
spec:
replicas: 3
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 50%
maxSurge: 1
selector:
matchLabels:
app: my-nginx
template:
metadata:
labels:
app: my-nginx
spec:
containers:
- name: nginx
image: nginx:alpine
ports:
- containerPort: 80
readinessProbe:
httpGet:
path: /index.html
port: 80
failureThreshold: 1
periodSeconds: 10
---
apiVersion: v1
kind: Service
metadata:
name: my-service
namespace: default
spec:
type: NodePort
selector:
app: my-nginx
ports:
- protocol: TCP
nodePort: 30000
port: 80
targetPort: 80
# Beispiel ohne Zugangsdaten
apiVersion: v1
kind: Config
preferences: {}
clusters:
- cluster:
certificate-authority-data: LS0tLS1C...
server: https://1.2.3.4:6443
name: cttest
- cluster:
certificate-authority-data: LS0tLS1CRU...
server: https://kubernetes.docker.internal:6443
name: docker-desktop
contexts:
- context:
cluster: cttest
user: cttest
name: cttest
- context:
cluster: docker-desktop
user: docker-desktop
name: docker-desktop
users:
- name: cttest
user:
client-certificate-data: LS0tLS1...
client-key-data: LS0tLS1C...
- name: docker-desktop
user:
client-certificate-data: LS0tLS...
client-key-data: LS0tL...
---
apiVersion: v1
kind: Pod
metadata:
name: my-first-nginx
labels:
app: my-nginx
spec:
containers:
- name: nginx
image: nginx:alpine
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: my-service
namespace: default
spec:
type: NodePort
selector:
app: my-nginx
ports:
- protocol: TCP
nodePort: 30000
port: 80
targetPort: 80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment