Certified Kubernetes Administrator Study Guide
Certified Kubernetes Administrator Study Guide
https://kubernetes.io/docs/
https://github.com/kubernetes
https://kubernetes.io/blog/
If you don't pass on your first try, you get one retake.
apiVersion: v1
kind: Service
metadata:
name: nginx-service
spec:
selector:
app: nginx
type: ClusterIP
ports:
- protocol: TCP
port: 80
targetPort: 8080
You can use "kubectl get service" to see the IP address
of the service.
apiVersion: v1
kind: Service
metadata:
name: nginx-service
spec:
selector:
app: nginx
type: NodePort
ports:
- protocol: TCP
port: 80
targetPort: 8080
You can use "kubectl get service" to see the IP address
of the node.
apiVersion: v1
kind: Pod
metadata:
name: nginx
labels:
env: test
spec:
containers:
- name: nginx
image: nginx
nodeSelector:
disktype: ssd
apiVersion: v1
kind: Pod
metadata:
labels:
test: liveness
name: liveness-exec
spec:
containers:
- name: liveness
image: k8s.gcr.io/busybox
args:
- /bin/sh
- -c
- touch /tmp/healthy; sleep 30; rm -rf /tmp/healthy; sleep 600
livenessProbe:
exec:
command:
- cat
- /tmp/healthy
initialDelaySeconds: 5
periodSeconds: 5
MultiContainer pod/sidecar containers
The primary purpose of a multi-container pod is to
support a co-located helper container for the main
program.
The standard logging method for containerized
applications is writing to standard output and standard
error streams.
containers:
- name: nginx
image: nginx
volumeMounts:
- name: shared-logs
mountPath: /var/log/nginx
- name: sidecar-container
image: busybox
command: ["sh","-c","while true; do cat /var/log/nginx/access.log
/var/log/nginx/error.log; sleep 30; done" ]
volumeMounts:
- name: shared-logs
mountPath: /var/log/nginx
How to configure a pod to use a ConfigMap
ConfigMaps store data in key-value format. A possible
usecase of ConfigMaps is keeping application code and
configuration separate.
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
metadata:
name: allow-traffic-from-namespace
spec:
podSelector:
matchLabels:
ingress:
- from:
- namespaceSelector:
matchLabels:
purpose: production
This policy will allow traffic to all pods from the
production namespace.
How to create an ingress resource
An ingress controller is a type of load balancer. It
accepts traffic from outside the cluster and loads the
balance to pods. We can also configure rules like
redirections.
Storage Module
This section is all about creating persistence volume,
persistence volume claims, and mounting into to a pod.
It's helpful to study a lot about persistence and
persistence volume.
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: standard
parameters:
type: pd-standard
provisioner: kubernetes.io/gce-pd
allowVolumeExpansion: true
reclaimPolicy: Delete
Then edit PVC to request more space:
kubectl edit pvc myclaim and update request parameter
Once PVC is updated, you need to replace the pod to
change to effect. You can check the new size by
"kubectl get pvc. myclaim".
Troubleshooting Module
This part covers 30% of the exam. You can expect
questions about how to troubleshoot nodes.
https://kubernetes.io/docs/tasks/debug-application-
cluster/debug-cluster/
https://kubernetes.io/
https://www.cncf.io/
https://github.com/ahmetb/kubernetes-network-policy-
recipes
https://www.katacoda.com/courses/kubernetes
https://jenciso.github.io/personal/manage-tls-
certificates-for-kubernetes-users