Kubernetes Administrator (CKA)
Published: 2022-12-09 14:07:59

---
title: Kubernetes Administrator (CKA)
published: true
date: 2022-12-03 12:02:25 UTC
tags: 
canonical_url: https://blog.niradler.com/kubernetes-administrator-cka
---

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

Purchase the exam certificate at this [link](https://training.linuxfoundation.org/certification/certified-kubernetes-administrator-cka/), the exam cost 395$ and you get 2 tries, and 2 demo tries at [killer.sh](https://killer.sh/)

Preparation course on [Udemy](https://udemy.com/course/certified-kubernetes-administrator-with-practice-tests)

Kubernetes Overview

![k8s.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1667730783270/U1JanFblD.png)

Setting up the local environment using [minikube](https://minikube.sigs.k8s.io/docs/start)

```
brew install minikube
minikube start
kubectl get po -A

```

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

```
KUBE_EDITOR=nano

```

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

```

### Introduction to Kubernetes Tools

Check out the kubectl [cheatsheet](https://kubernetes.io/docs/reference/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

```

kubectl is not the only tool you will need, make sure to read about [etcdctl](https://kubernetes.io/docs/tasks/administer-cluster/configure-upgrade-etcd/#snapshot-using-etcdctl-options), and [others](https://kubernetes.io/docs/reference/command-line-tools-reference/).

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:

- [static pods](https://kubernetes.io/docs/tasks/configure-pod-container/static-pod/)

- [etcd backup and restore](https://kubernetes.io/docs/tasks/administer-cluster/configure-upgrade-etcd/)

- [services](https://kubernetes.io/docs/concepts/services-networking/service/)

- [volumes](https://kubernetes.io/docs/concepts/storage/volumes/)

Configurations location:

- `/etc/kubernetes`

- `/etc/kubernetes/manifests`

you are allowed to use the Kubernetes docs while solving the exam, you can use these [bookmarks](https://drive.google.com/file/d/1gh9HIYoEP5iW8osayXOGncfSA5xCaN3Z/view?usp=sharing) 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](https://kubernetes.io/docs) while solving the test.

_the bookmarks folder did not create by me, I found it online_