Skip to content

Instantly share code, notes, and snippets.

@jakoberpf
Created July 8, 2023 11:13
Show Gist options
  • Save jakoberpf/20f872f0e383f18adc3599730aa8b713 to your computer and use it in GitHub Desktop.
Save jakoberpf/20f872f0e383f18adc3599730aa8b713 to your computer and use it in GitHub Desktop.
CKAD command tips.md

Some tips and common pitfalls for the CKAD exam.

auto shell configuration

Note: I am currently not sure if this would be allowed in the exam, as this is an external ressource.

# curl -s https://gist.github.com/6e3acd88f2f88394ad88e2dff1d8e530 | sh

kubectl to yaml

When suppliying --dry-run=client -o yaml to kubectl we don't create resources right away, but are provided with the yaml the resources would be created with. This is helpfull to create pod or deployment yaml template.

kubectl ... --dry-run=client -o yaml
kubectl run pod --image=nginx --dry-run=client -o yaml
kubectl create deployment nginx --image=nginx --dry-run=client -o yaml
kubectl create service clusterip nginx --tcp=443:80 --dry-run=client -o yaml

run temporary pod for single command execution

kubectl run tmp --restart=Never --rm -i --image=nginx:alpine -- curl 10.44.0.78
  • --restart=Never will disable restarting the pod after it finished the command. If not supplied we won't see any output in the terminal
  • --rm will remove the pod after running the command
  • -i makes it interactive and will show the output of the command in the terminal

base64 conversion

When converting strings into base64, the flag -n should be supplied to ensure no line breaks.

echo -n "..." | base64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment