Last active
February 2, 2023 14:06
-
-
Save onmomo/25407bc76be15554b4f85fd8fce4395e to your computer and use it in GitHub Desktop.
[kubectl magic] cheatsheet #k8s
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
# export, import secrets < 1.14 | |
kubectl get secret $my-secret --export -o yaml -n $source-ns | kubectl -n $target-ns apply -f - | |
# export => 1.14 | |
SECRET= SOURCE= TARGET= \ | |
&& kubectl get secret $SECRET --namespace=$SOURCE -o yaml | sed "s/namespace: .*/namespace: $TARGET/" | kubectl apply -f - | |
# force delete resources | |
kubectl -n prometheus delete --force --grace-period=0 pod | |
# run pod from any image | |
kubectl run -i --tty busybox --image=busybox --restart=Never -- bash | |
# get service ingress lb | |
kubectl get svc -A | grep -i nginx | |
# headless service SRV record lookup | |
kubectl run -i --tty busybox --image=k8s.gcr.io/e2e-test-images/jessie-dnsutils:1.3 --restart=Never -- bash | |
nslookup -type=srv apache-kafka-headless | |
# lookup resource descriptions | |
kubectl explain pods |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment