k8s operations
k8s operations
Everyday kubectl commands for a running cluster: shell into a pod, scale, export, stop and debug.
Interactive shell
kubectl exec -it <pod-name> -- bashScale
kubectl scale deployment nginx-test --replicas=3Export
kubectl get pod <pod-name> -o yaml > pod-config.yamlStop pod
kubectl delete pod <pod-name>Create a debug pod
apiVersion: v1
kind: Pod
metadata:
name: toolbelt
labels:
purpose: debug
spec:
containers:
- name: debian-tooling
image: debian:latest
command: ["/bin/bash", "-c", "--"]
args: ["while true; do sleep 30; done;"]
volumeMounts:
- name: app-data
mountPath: /mnt/data
volumes:
- name: app-data
persistentVolumeClaim:
claimName: app-data