This repository contains my notes, definitions, tips, sources, and commands that I used to prepare for the Certified Kubernetes Application Developer exam.
pie showData
title CKAD categories
"Application Design and Build" : 20
"Application Deployment" : 20
"Application Observability and Maintenance" : 15
"Application Environment, Configuration and Security" : 25
"Services and Networking" : 20
More information Training Linux Fundation Updated September 28, 2021. You can also check the curriculum
Here there is a summary of each category!
- πΎ Application Design and Build
- πΎ Application Deployment
- πΎ Application Observability and Maintenance
- πΎ Application Environment, Configuration and Security
- πΎ Services and Networking
vim .vimrc
set expandtab # This tells Vim to convert tabs into spaces.
set tabstop=2 # This sets the width of a tab character to 2 spaces.
set shiftwidth=2 # This controls the number of spaces used for auto-indentation when using commands like >> (indent) or << (outdent) in Vim.
# List current contexts
kubectl config get-contexts
# Every time before to start the question
kubectl config use-contex <CONTEXTNAME>
# Note: The asterisk represents the current context
# Alias "kubectl"
alias k='kubectl'
k get pods
# Alias "kubectl apply -f"
alias ka='kubectl apply -f'
ka pod1.yaml
# Delete a pod with grace period
alias kdp='kubectl delete pod --force --grace-period 0'
kdp mypod
# Alias "config set-context --current --namespace"
alias kns='config set-context --current --namespace'
#Export "--dry-run=client -o yaml"
export do="--dry-run=client -o yaml"
k run my-pod --image=nginx $do > pod.yaml
source <(kubectl completion bash) # setup autocomplete in bash into the current shell, bash-completion package should be installed first.
echo "source <(kubectl completion bash)" >> ~/.bashrc # add autocomplete permanently to your bash shell.
alias k=kubectl
complete -F __start_kubectl k
# To get all the resorces in a namespaces
kubectl get all
# Describe a resource
kubectl describe pod yellow
# Generate a preview without a file
kubectl create namespace test-123 --dry-run=client -o yaml
# "edit" to edit existing resources
kubectl edit pod nginx
kubectl edit deployment app
# "set" to update a version in a pod or deployment
kubectl set image pod/nginx nginx=nginx:latest
kubectl set image pod/nginx nginx=nginx:1.9.1
kubectl set image deployment/nginx nginx=nginx:latest
kubectl set image deployment/nginx nginx=nginx:1.9.1
Log and Debugging
k run --image=busybox bbox -- sh -c 'while true; do date; sleep 3; done '
kubectl logs busybox
# Follow the logs
kubectl logs busybox -f
kubectl logs webapp-1 | grep USER5
# to select the containers
kubectl logs webapp-2 -c
kubectl logs webapp-2 -c simple-webapp
kubectl logs alta3pod | sudo tee ~/opt/answers/mypod.log
# See the error of a pod
kubectl get events | grep -i error
kubectl dev-pod -c log-x | grep WARN > /opt/logs.txt
# To keep watching the logs
kubectl logs bbox --follow
# Use describe
kubectl describe bbox
kubectl describe mydeploy
# See the event for all the resources
kubectl get events
# Using grep
kubectl get events | grep Schedule
# View control exec
kubectl run --image=busybox bbox -- sh -c 'echo here; sleep 3600'
# Access to the shell inside the pod
kubectl exec -it bbox -- sh
ls
exit
# Check all the deployments in all the namespaces
k get get deploy --all-namespaces
# List pods and services in a single namespace
kubectl -n elastic-stack get pod, svc
# To check for more options
kubectl explain pods --recursive | less
/volumeMounts
# Monitorins
kubectl top node
kubectl top pod
Observability
# Collect failed pods by namespace
kubectl -n qa get events | grep -i 'Liveness probe failed'
# Check pods in all namespaces with READY = 0
k get pod --all-namespaces | grep -i 0
# Check Liveness and Readiness status
kubectl describe pod nginx | grep -i liveness
kubectl describe pod nginx | grep -i readiness
# You'll see the error here as well
kubectl get events | grep -i error
# kubectl cp command
kubectl cp busybox:etc/passwd ./passwd
Download in PDF -> Made by Edith Puclla
From Udemy course with Mumshad Mannambeth
- Attempt all questions
- Don't get stuck on any question
- Get good with YAML
- Use shortcuts/aliases
- po for Pods
- rs for RepicaSets
- deploy for Deployments
- svc for Services
- ns for Namespaces
- netpol for Networking polices
- pv for Persistent Volumes
- pvc for PersistentVolumeClaims
- sa for service accounts
From - Muralidaran shanmugham
- Go through the k8s.io documentation
- Understand all the concepts outlined in the exam curriculum
- Register for courses like Kodekloud
- Time management
- nano Editor
- Kubectl alias
- learn shortcuts
- alias k='kubectl'
- k config set-context --namespace=
- k explain cronjob.spec.jobTemplate --recursive
- know all the commands => HERE
- --restart (YAML generator)
- args: ["-c", "while true; do date >> /var/log/app.txt; sleep 5; done"]
- args: [/bin/sh, -c, 'i=0; while true; do echo "$i:
$(date)"; i=$ ((i+1)); sleep 1; done'] - args: ["-c", "mkdir -p collect; while true; do cat /var/data/*> /collect/data.txt; sleep 10; done"]
- Use of grep:
- kubectl describe pods | grep --context=10 annotations:
- kubectl describe pods | grep --context=10 Events:
# Open vim
vim ~/.vimrc
# Add these lines
set expandtab # Use spaces for tab
set tabstop=2 # Amount of spaces used for tab
set shiftwidth=2 # Amount of spaces used during indentation
# Move the cursor
- Use:
h -> move to left
l -> move to right
j -> move down
k -> move up
- Esc + w -> move word to word, set cursor at the beginning of the word
- Esc + e -> move word to word, set cursor at the end of the word
# Edit/view/find words or lines
- Esc + DD -> delete a line
- Esc + o -> add a new line
- Esc + :set nu -> to add line numbers
- Esc + dw -> Delete a word
- Esc + u -> revert changes
- Esc + / -> Find a word
* Esc :num + Enter -> go a specific number line in a file, example: Esc :22
# Indent several lines
- Shift + v -> to visual mode and up and down arrows to move the cursor
- Shift + > -> indentation to the right
- Shift + < -> indentation to the left
- Shift + 2> -> indentation to the right, two times
- Shift + 3< -> indentation to the left, three times
# Copy and paste single line
- Esc + y -> copy a line
- Esc + p -> paste the line
# copy and paste several lines
- Esc + V -> Mark lines, then arrow keys to select several lines
- Esc + y -> Copy marked lines
- Esc + d -> Cut marked lines
- Esc + p -> Past lines
# List all kubectl context
kubectl config get-context
# Change to cluster
kubectl config set current-context new-context
- Go to the documentation: https://kubernetes.io/docs/home/
- Select a topic
- Go to specific section of the page
- Set a bookmark
- If you need copy the code, use copy application to clipboard
# Kubectl Autocomplete
# Bash
source <(kubectl completion bash) # setup autocomplete in bash into the current shell, bash-completion package should be installed first.
echo "source <(kubectl completion bash)" >> ~/.bashrc # add autocomplete permanently to your bash shell.
alias k=kubectl
complete -F __start_kubectl k
alias kn='kubectl config set-context --current --namespace '
alias kd='kubectl delete pod --grace-period=0 --force'
alias dp='--grace-period=0 --force'
alias ka='kubectl apply -f'
export do='--dry-run=client -o yaml'
- Udemy CKAD preparation -> Mumshad Mannambeth
- Kubernetes documentation - bookmarks have to be based in the oficial documentation
-
How to Prepare for CKAD and CKA Certification? -> InfraCloud Team
-
Game of Pods A set of fun challenges to learn and practice your skills on Kubernetes
-
Kubernetes CKAD Example Exam Questions Practical Challenge Series -> Kim Wuestkamp
-
Practice Enough With These 150 Questions for the CKAD Exam -> Bhargav Bachina
-
CKAD Exercises Github -> dgkanatsios
-
How to Pass CKA, CKAD with Flying Colors? -> I AM DINUTH
-
How to CRUSH the CKAD Exam! -> Alta3 Research, Inc.
-
Vim Crash Course | How to edit files quickly in CKAD / CKA exam -> The FrontOps Guy
-
Linux Foundation Kubernetes Certifications Now Include Exam Simulator -> killer.sh CKA, CKAD, or CKS simulator