Last active
June 6, 2023 13:24
-
-
Save jamct/f75fb87a67987570c0b06b189031859e to your computer and use it in GitHub Desktop.
Beispiele: Kubernetes-Einstieg für Docker-Kenner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
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