What will happen:
Friendly reminders:
Image obtained from Linux Foundation Tips CKA and CKAD
In this game, you play as a Kubernetes administrator that has to clear his way out of 16 tasks so he can go home before 8 PM.
Simple:
Multiple steps
Quick questions that will grant you enough space to breath between the ones with 7%
# List only running pods but in a cool way
k get pods --field-selector=status.phase=Running
# List nodes with a specific label and sort them by performance. Once done, tell me your Ascendant Zodiac sign.
k top pods -l name=LABEL_NAME --sort-by-cpu
# Run the coolest NGINX that you could imagine but with a custom env variable to make it unique and divergent
k run nginx --image=nginx --env=myteam:variable
# To assert dominance over the others k8s admins, use JSONPATH to get the pod name followed by the started timestamp
k get pod nginx -o jsonpath='{.metadata.name}{"\t"}{.status.containerStatuses[*].state.running.startedAt}{"\n"}'
You will wonder if it is truly worth the time.
# Run a deployment with a pod that does things in a mounted volume# (...)
template:
# (...)
spec:
containers:
- image: busybox
name: busy-worker
command: ["/bin/sh"]
args: ["-c", "while true; do echo $(date) >> /var/log/execution.log; sleep 1; done"]
volumeMounts:
- name: logs
mountPath: /var/log
volumes:
- name: logs
Why are still here? Just to deploy?
# Now do a flip, and then add sidecar reading from that same volume# (...)
template:
# (...)
spec:
containers:
# (...)
- image: alpine
name: sidecar
command: ["/bin/sh", "-c", "tail -f /var/log/execution.log"]
volumeMounts:
- name: logs
mountPath: /var/log
# (...)
Image obtained from Killer CKA