Mock Test 2
1. Question
Take a backup of the etcd cluster and save it to /opt/etcd-backup.db
.
Answer
|
|
2. Question
Create a Pod called redis-storage
with image: redis:alpine
with a Volume of type emptyDir
that lasts for the life of the Pod.
Pod named ‘redis-storage’ created
Pod ‘redis-storage’ uses Volume type of emptyDir
Pod ‘redis-storage’ uses volumeMount with mountPath = /data/redis
Answer
|
|
3. Question
Create a new pod called super-user-pod
with image busybox:1.28
. Allow the pod to be able to set system_time
.
The container should sleep for 4800
seconds.
Pod: super-user-pod
Container Image: busybox:1.28
Is SYS_TIME capability set for the container?
Answer
|
|
4. Question
A pod definition file is created at /root/CKA/use-pv.yaml
. Make use of this manifest file and mount the persistent volume called pv-1
. Ensure the pod is running and the PV is bound.
mountPath: /data
persistentVolumeClaim Name: my-pvc
Answer
Add a persistentVolume
definition to pod definition file.
|
|
Update the pod definition file
|
|
5. Question
Create a new deployment called nginx-deploy
, with image nginx:1.16
and 1
replica. Next upgrade the deployment to version 1.17
using rolling update.
Deployment : nginx-deploy. Image: nginx:1.16
Image: nginx:1.16
Task: Upgrade the version of the deployment to 1:17
Task: Record the changes for the image upgrade
Answer
|
|
6. Question
Create a new user called john
. Grant him access to the cluster.
John should have permission to create, list, get, update and delete pods
in the development
namespace .
The private key exists in the location: /root/CKA/john.key
and csr at /root/CKA/john.csr
.
Important Note: As of kubernetes 1.19, the CertificateSigningRequest object expects a signerName
.
CSR: john-developer Status:Approved
Role Name: developer, namespace: development, Resource: Pods
Access: User ‘john’ has appropriate permissions
Answer
|
|
|
|
To approve this certificate,
|
|
Create a role developer
and rolebinding developer-role-binding
|
|
Verify the permission
|
|
7. Question
Create a nginx pod called nginx-resolver
using image nginx
, expose it internally with a service called nginx-resolver-service
.
Test that you are able to look up the service and pod names from within the cluster. Use the image: busybox:1.28
for dns lookup. Record results in /root/CKA/nginx.svc
and /root/CKA/nginx.pod
Pod: nginx-resolver created
Service DNS Resolution recorded correctly
Pod DNS resolution recorded correctly
Answer
Use the command k run and create a nginx pod and busybox pod. Resolve it, nginx service and its pod name from busybox pod.
To create a pod nginx-resolver and expose it internally:
|
|
To create a pod test-nslookup. Test that you are able to look up the service and pod names from within the cluster:
|
|
Get the IP of the nginx-resolver pod and replace the dots(.) with hyphon(-) which will be used below.
|
|
8. Question
Create a static pod on node01
called nginx-critical
with image nginx
and make sure that it is recreated/restarted automatically in case of a failure.
Use /etc/kubernetes/manifests
as the Static Pod path for example.
static pod configured under /etc/kubernetes/manifests ?
Pod nginx-critical-node01 is up and running
Answer
To create a static pod called nginx-critical by using below command:
|
|
Copy the contents of this file or use scp command to transfer this file from controlplane to node01 node.
|
|
To know the IP Address of the node01 node:
|
|
On node01 node:
Check if static pod directory is present which is /etc/kubernetes/manifests
, if it’s not present then create it.
|
|
Add that complete path to the staticPodPath
field in the kubelet config.yaml
file.
|
|
|
|
now, move/copy
the static.yaml to path /etc/kubernetes/manifests/
.
|
|
Go back to the controlplane node and check the status of static pod:
|
|