DEV Community

Nir Adler
Nir Adler

Posted on • Originally published at blog.niradler.com on

Kubernetes Administrator (CKA)

Hi, I'm doing the CKA certificate and wanted to share some details.

Purchase the exam certificate at this link, the exam cost 395$ and you get 2 tries, and 2 demo tries at killer.sh

Preparation course on Udemy

Kubernetes Overview

k8s.png

Setting up the local environment using minikube

brew install minikube
minikube start
kubectl get po -A

Enter fullscreen mode Exit fullscreen mode

you can set a default kube editor altho I recommend staying with vim.

KUBE_EDITOR=nano

Enter fullscreen mode Exit fullscreen mode

recommended shell configuration

alias k=kubectl # will already be pre-configured
export do="--dry-run=client -o yaml" # k create deploy nginx --image=nginx $do
export now="--force --grace-period 0" # k delete pod x $now

Enter fullscreen mode Exit fullscreen mode

Introduction to Kubernetes Tools

Check out the kubectl cheatsheet, here are some examples of common tasks.

kubectl config get-contexts # print config contexts 
kubectl config use-context my-ctx # switch context to my-ctx
kubectl run nginx --image=nginx # create a pod with name nginx and image nginx:latest
kubectl get pods -o wide # list pods in defauult namespace with extra details
kubectl run nginx --image=nginx --dry-run=client -o yaml # print yaml configuration to run pod nginx
kubectl create deployment --image=nginx nginx --replicas=4 --dry-run=client -o yaml > nginx-deployment.yaml # print yaml configuration to create deployment nginx and direct the output to a new file
kubectl create -f nginx-deployment.yaml # create resources from yaml template
kubectl apply -f nginx-deployment.yaml # apply resources from yaml template
kubectl describe node cluster1-master1 # get resource details
kubectl get pod -A --sort-by=.metadata.uid # print all the pods in the cluster and sort them by the field .metadata.uid
kubectl get pod -o jsonpath="{range .items[*]} {.metadata.name}{.spec.containers[*].resources}{'\n'}" # manipulate output with jsonpath
k expose pod nginx --name nginx-service --port 80
k create ns my-namespace
k -n secret create secret generic mysecret --from-literal=user=myuser --from-literal=pass=1111
kubectl scale --current-replicas=2 --replicas=3 deployment/mysql

Enter fullscreen mode Exit fullscreen mode

kubectl is not the only tool you will need, make sure to read about etcdctl, and others.

Terminal tools you should know: (short list for some of the advanced question more tools and Linux familiarity is needed)

  • vim

  • wc

  • grep

Topics you should master:

Configurations location:

  • /etc/kubernetes

  • /etc/kubernetes/manifests

you are allowed to use the Kubernetes docs while solving the exam, you can use these bookmarks for faster navigation in the Kubernetes docs, make sure to use only the CKA exam folder, you are not allowed to search in any site that is not the official docs while solving the test.

the bookmarks folder did not create by me, I found it online

Top comments (0)