#Bash into container k exec -it wiki-dokuwiki-9f9fd859d-2wfx6 bash ### Useful aliases ### kush [-n ns] pod_name # get shell into pod kud pod_name # kubectl describe pod kug pod pod_name # kubectl get pod_name ktail pod_name # get logs for the pod # fetch chart to analyse values.yaml helm fetch gitlab/gitlab --untar # debug certs kug orders,challenges -o wide # Delete PV that has finalizers pv=pvc-daec7eed-fc8e-4281-a15b-6b370df54804 echo '{"metadata": {"finalizers": null}}' | kubectl patch pv $pv --patch-file=/dev/stdin # Delete POD that got stuck (and no finalizers to delete) kubectl delete pods fluent-bit-xczr2 --grace-period=0 --force #copy file into pod kubectl cp /mnt/common/tmp/run dev/page2-dp-77f87664bb-4l8mc:/tmp/run # Delete namespace that got stuck namespaceToDelete=brocha kubectl get namespace "$namespaceToDelete" -o json | \ jq 'del(.spec.finalizers)' | \ kubectl replace --raw /api/v1/namespaces/$namespaceToDelete/finalize -f - # drain and evict pods from a node kubectl drain --ignore-daemonsets --delete-emptydir-data k8i03 #untaint kubectl uncordon k8i03 # port forwarding of localport 40090 to port 9090 of the svc kubectl port-forward -n monitoring svc/prometheus-k8s 40090:9090 --address='0.0.0.0' # see nodes labels kug nodes --show-labels # remove label worker from a node: kubectl label node ip-10-0-7-187.ec2.internal worker- # add control-plane label kubectl label node k8r05 node-role.kubernetes.io/control-plane= kubectl label node k8p01 general=yes # See cpu/mem usage by nodes kubectl top node # Show pod by label kug pod -n monitoring -l app.kubernetes.io/name=kube-state-metrics # kill pods by label kudel pod -n nqa -l app=etljobs-sel # watch hpa of gwpa@rnd kug hpa -n rnd gwpa-hpa --watch # events on API of prod2 farm kug events -n prod2