kubectl get all -A -o wide
kubectl get nodes [node-name] [-o wide]
kubectl describe nodes [node-name]
===== Namespace anlegen =====
Namespace mit Namen __demo__ anlegen
kubectl create namespace demo
Namespace __demo__ als aktuellen context festlegen
kubectl set-context --current --namespace=demo
Pod mit __nginx__ starten und __Port 80__ freigeben
kubectl run web --image nginx --labels app=web --expose --port 80
Zweiten Pod mit __alpine-Linux__ interaktiv starten, curl installieren und web-Pod (nginx) aufrufen
kubectl run test --rm --ti --image alpine -- /bin/sh
apk add curl
curl web
...
Welcome to nginx!
...
In einer anderen Console alles im Namespace __demo__ auflisten
kubectl get all
NAME READY STATUS RESTARTS AGE
pod/test 1/1 Running 0 10s
pod/web 1/1 Running 0 26m
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/web ClusterIP 10.96.247.18 80/TCP 26m
Webapp als yaml ausgeben
kubectl run web --image nginx --labels app=web --expose --port 80 --dry-run=client --output=yaml
apiVersion: v1
kind: Service
metadata:
creationTimestamp: null
labels:
app: web
name: web
spec:
ports:
- port: 80
protocol: TCP
targetPort: 80
selector:
app: web
status:
loadBalancer: {}
---
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
app: web
name: web
spec:
containers:
- image: nginx
name: web
ports:
- containerPort: 80
resources: {}
dnsPolicy: ClusterFirst
restartPolicy: Always
status: {}