kubectl patch deployment hello --patch "spec: template: spec: containers: # If not same name, then new container is created, otherwise it's replacing the container. - name: smaller-nginx image: nginx:alpine"
kubectl set {image,serviceaccount,resources,env...}
kubectl get nodes --label-columns kubenertes.io/arch,node.kubernetes.io/instance-type
Check which controllers own our pod.
kubectl get pod -o custom-columns=\NAME:.metadata.name,\OWNER-KIND:.metadata.ownerReferences\[0\].kind,\OWNER-NAME:.metadata.ownerReferences\[0\].name,
List the permissions we have.
kubectl auth can-i --list# check someone else's, if you're an adminkubectl auth can-i --list --as --system:kube-scheduler
Turn a Deployment off and on again: kubectl rollout restart deployment hello
Useful if you want to fix some bug, so you don’t want any Pod from this Deployment, but you don’t want to re-create the Deployment afterwards.
Also useful to turn off stuff that’s not in use to save cost.
Why did I want to read/watch this?
At my company, there’s a project to migrate to kubernetes, so I had to re-dive into kubernetes. Thus, I was quite eager to know more tips about kubernetes.
What did I get out of it?
Nice tips, really useful for sysadmins.
One I particularly like is using gron for making JSON grepable and nixery.dev for generating a docker image with the needed tools.