CKA問題集68問でKubernetes Administratorを確実実践
リアル最新CKA試験問題CKA問題集
Linux Foundationは、オープンソースソフトウェア開発の分野の先駆者としての地位を確立しており、その認定Kubernetes管理者(CKA)プログラム認定試験はその事実の証です。 Kubernetesはコンテナオーケストレーションの事実上の基準として浮上しており、CKAプログラムは、この技術に習熟しようとする専門家に必要なスキルを伝えることを目指しています。
質問 # 20
Score: 4%
Task
Check to see how many nodes are ready (not including nodes tainted NoSchedule ) and write the number to
/opt/KUSC00402/kusc00402.txt
正解:
解説:
See the solution below.
Explanation
Solution:
kubectl describe nodes | grep ready|wc -l
kubectl describe nodes | grep -i taint | grep -i noschedule |wc -l
echo 3 > /opt/KUSC00402/kusc00402.txt
#
kubectl get node | grep -i ready |wc -l
# taintsnoSchedule
kubectl describe nodes | grep -i taints | grep -i noschedule |wc -l
#
echo 2 > /opt/KUSC00402/kusc00402.txt
質問 # 21
Update the deployment with the image version 1.16.1 and verify the image and check the rollout history
正解:
解説:
kubectl set image deploy/webapp nginx=nginx:1.16.1 kubectl describe deploy webapp | grep Image kubectl rollout history deploy webapp
質問 # 22
Get list of PVs and order by size and write to file "/opt/pvstorage.txt"
正解:
解説:
kubectl get pv --sort-by=.spec.capacity.storage > /opt/pv storage.txt
質問 # 23
To protect your firewall and network from single source denial of service (DoS) attacks that can overwhelm its packet buffer and cause legitimate traffic to drop, you can configure:
- A. PGP (Packet Gateway Protocol)
- B. PBP (Packet Buffer Protection)
- C. PBP (Protocol Based Protection)
- D. BGP (Border Gateway Protocol)
正解:C
質問 # 24
Create a deployment called webapp with image nginx having 5 replicas in it, put the file in /tmp directory with named webapp.yaml
- A. //Create a file using dry run command
kubectl create deploy --image=nginx --dry-run -o yaml >
/tmp/webapp.yaml
// Now, edit file webapp.yaml and update replicas=5
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: webapp
name: webapp
spec:
replicas: 5
selector:
matchLabels:
app: webapp
template:
metadata:
labels:
app: webapp
spec:
containers:
- image: nginx
name: nginx
Note: Search "deployment" in kubernetes.io site , you will get
the page
https://kubernetes.io/docs/concepts/workloads/controllers/deplo
yment/
// Verify the Deployment
kubectl get deploy webapp --show-labels
// Output the YAML file of the deployment webapp
kubectl get deploy webapp -o yaml - B. //Create a file using dry run command
kubectl create deploy --image=nginx --dry-run -o yaml >
/tmp/webapp.yaml
// Now, edit file webapp.yaml and update replicas=5
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: webapp
name: webapp
spec:
replicas: 5
selector:
matchLabels:
app: webapp
template:
metadata:
labels:
Note: Search "deployment" in kubernetes.io site , you will get
the page
https://kubernetes.io/docs/concepts/workloads/controllers/deplo
yment/
// Verify the Deployment
kubectl get deploy webapp --show-labels
// Output the YAML file of the deployment webapp
kubectl get deploy webapp -o yaml
正解:A
質問 # 25
Monitor the logs of pod foo and:
* Extract log lines corresponding to error
unable-to-access-website
* Write them to/opt/KULM00201/foo
正解:
解説:
See the solution below.
Explanation
solution

質問 # 26
Create a deployment as follows:
Name: nginx-random
Exposed via a service nginx-random
Ensure that the service & pod are accessible via their respective DNS records The container(s) within any pod(s) running as a part of this deployment should use the nginx Image Next, use the utility nslookup to look up the DNS records of the service & pod and write the output to
/opt/KUNW00601/service.dns and /opt/KUNW00601/pod.dns respectively.
正解:
解説:
See the solution below.
Explanation
Solution:
F:\Work\Data Entry Work\Data Entry\20200827\CKA\17 C.JPG
F:\Work\Data Entry Work\Data Entry\20200827\CKA\17 D.JPG
F:\Work\Data Entry Work\Data Entry\20200827\CKA\17 E.JPG
質問 # 27
Check the history of the specific revision of that deployment
正解:
解説:
kubectl rollout history deploy webapp --revision=3
質問 # 28
Watch the job that runs 10 times one by one and verify 10 pods are created and delete those after it's completed
正解:
解説:
kubectl get job -w kubectl get po kubectl delete job hello-job
質問 # 29
Check nodes which are ready and print it to a file /opt/nodestatus
- A. JSONPATH='{range .items[*]}{@.metadata.name}:{range
@.status.conditions[*]}{@.type}={@.status};{end}{end}' \
//Verify
cat /opt/node-status - B. JSONPATH='{range .items[*]}{@.metadata.name}:{range
@.status.conditions[*]}{@.type}={@.status};{end}{end}' \
&& kubectl get nodes -o jsonpath="$JSONPATH" | grep
"Ready=True" > /opt/node-status
//Verify
cat /opt/node-status
正解:B
質問 # 30
Create a pod named kucc8 with a single app container for each of the following images running inside (there may be between 1 and 4 images specified):
nginx + redis + memcached.
正解:
解説:
solution


質問 # 31
Score: 5%
Task
Monitor the logs of pod bar and:
* Extract log lines corresponding to error
* Write them to /opt/KUTR00101/bar
正解:
解説:
See the solution below.
Explanation
Solution:
kubectl logs bar | grep 'unable-to-access-website' > /opt/KUTR00101/bar cat /opt/KUTR00101/bar
質問 # 32
Create a pod with init container which waits for a service called "myservice" to be created. Once init container completes, the myapp-container should start and print a message "The app is running" and sleep for 3600 seconds.
- A. vim multi-container-pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: myapp-pod
labels:
app: myapp
spec:
containers:
- name: myapp-container
image: busybox:1.28
command: ['sh', '-c', 'echo The app is running! && sleep
3600']
initContainers:
- name: init-myservice
image: busybox:1.28
command: ['sh', '-c', "until nslookup myservice.$(cat
/var/run/secrets/kubernetes.io/serviceaccount/namespace).s
vc.cluster.local; do echo waiting for myservice; sleep 2;
done"]
// Check whether service called "myservice" exists
kubectl get svc
Note: Pod will not start if service called "myservice" doesn't
exist.
// Now, Create the pod
kubectl apply -f multi-container-pod.yaml - B. vim multi-container-pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: myapp-pod
labels:
app: myapp
spec:
containers:
- name: myapp-container
image: busybox:1.28
command: ['sh', '-c', 'echo The app is running! && sleep
3600']
initContainers:
- name: init-myservice
done"]
// Check whether service called "myservice" exists
kubectl get svc
Note: Pod will not start if service called "myservice" doesn't
exist.
// Now, Create the pod
kubectl apply -f multi-container-pod.yaml
正解:A
質問 # 33
Create a Job with an image node which prints node version and
verifies there is a pod created for this job
- A. kubectl create job nodeversion --image=node -- node -v
kubectl get job -w
kubectl get pod
YAML File:
apiVersion: batch/v1
kind: Job
metadata:
labels:
job-name: nodeversion
name: nodeversion
spec:
completions: 1
parallelism: 1
labels:
job-name: nodeversion
spec:
containers:
- command:
- node
- -v
image: node
imagePullPolicy: Always
name: nodeversion
restartPolicy: Never - B. kubectl create job nodeversion --image=node -- node -v
kubectl get job -w
kubectl get pod
YAML File:
apiVersion: batch/v1
kind: Job
metadata:
labels:
job-name: nodeversion
name: nodeversion
spec:
completions: 1
parallelism: 1
selector:
matchLabels:
job-name: nodeversion
template:
metadata:
labels:
job-name: nodeversion
spec:
containers:
- command:
- node
- -v
image: node
imagePullPolicy: Always
name: nodeversion
restartPolicy: Never
正解:B
質問 # 34
Configure the kubelet systemd- managed service, on the node labelled with name=wk8s-node-1, to launch a pod containing a single container of Image httpd named webtool automatically. Any spec files required should be placed in the /etc/kubernetes/manifests directory on the node.
You can ssh to the appropriate node using:
[student@node-1] $ ssh wk8s-node-1
You can assume elevated privileges on the node with the following command:
[student@wk8s-node-1] $ | sudo -i
正解:
解説:
solution




質問 # 35
A Kubernetes worker node, named wk8s-node-0 is in state NotReady. Investigate why this is the case, and perform any appropriate steps to bring the node to a Ready state, ensuring that any changes are made permanent.
You can ssh to the failed node using:
[student@node-1] $ | ssh Wk8s-node-0
You can assume elevated privileges on the node with the following command:
[student@w8ks-node-0] $ | sudo -i
正解:
解説:
solution


質問 # 36
Create a pod that having 3 containers in it? (Multi-Container)
正解:
解説:
image=nginx, image=redis, image=consul
Name nginx container as "nginx-container"
Name redis container as "redis-container"
Name consul container as "consul-container"
Create a pod manifest file for a container and append container
section for rest of the images
kubectl run multi-container --generator=run-pod/v1 --image=nginx --
dry-run -o yaml > multi-container.yaml
# then
vim multi-container.yaml
apiVersion: v1
kind: Pod
metadata:
labels:
run: multi-container
name: multi-container
spec:
containers:
- image: nginx
name: nginx-container
- image: redis
name: redis-container
- image: consul
name: consul-container
restartPolicy: Always
質問 # 37
List all the pods sorted by name
正解:
解説:
See the solution below.
Explanation
kubect1 get pods --sort-by=.metadata.name
質問 # 38
Configure the kubelet systemd-managed service, on the nodelabelled withname=wk8s-node-1, tolaunch a pod containing a singlecontainer of Image automatically. Any spec filesrequired should be placed in the/etc/kubernetes/manifests You canssh to theappropriate node using:
[student@node-1] $ sshwk8s-node-1
You can assume elevatedprivileges on the node with thefollowing command:
[student@wk8s-node-1] $ |sudo -i
正解:
解説:
See the solution below.
Explanation
solution




質問 # 39
Create an nginx pod with container Port 80 and it should only receive traffic only it checks the endpoint / on port 80 and verify and delete the pod.
- A. kubectl run nginx --image=nginx --restart=Never --port=80 --
dry-run -o yaml > nginx-pod.yaml
// add the readinessProbe section and create
vim nginx-pod.yaml
run: nginx
name: nginx
spec:
containers:
- image: nginx
name: nginx
ports:
- containerPort: 60
readinessProbe:
httpGet:
path: /
port: 60
restartPolicy: Never
kubectl apply -f nginx-pod.yaml
// verify
kubectl describe pod nginx | grep -i readiness
kubectl delete po nginx - B. kubectl run nginx --image=nginx --restart=Never --port=80 --
dry-run -o yaml > nginx-pod.yaml
// add the readinessProbe section and create
vim nginx-pod.yaml
apiVersion: v1
kind: Pod
metadata:
labels:
run: nginx
name: nginx
spec:
containers:
- image: nginx
name: nginx
ports:
- containerPort: 80
readinessProbe:
httpGet:
path: /
port: 80
restartPolicy: Never
kubectl apply -f nginx-pod.yaml
// verify
kubectl describe pod nginx | grep -i readiness
kubectl delete po nginx
正解:B
質問 # 40
Check the image version in pod without the describe command
正解:
解説:
See the solution below.
Explanation
kubectl get po nginx -o
jsonpath='{.spec.containers[].image}{"\n"}'
質問 # 41
Create a pod that echo "hello world" and then exists. Have the pod deleted automatically when it's completed
正解:
解説:
kubectl run busybox --image=busybox -it --rm --restart=Never -- /bin/sh -c 'echo hello world' kubectl get po # You shouldn't see pod with the name "busybox"
質問 # 42
Create 5 nginx pods in which two of them is labeled env=prod and
three of them is labeled env=dev
- A. kubectl run nginx-dev1 --image=nginx --restart=Never --
labels=env=dev
kubectl run nginx-dev2 --image=nginx --restart=Never --
labels=env=dev
kubectl run nginx-prod1 --image=nginx --restart=Never --
labels=env=prod
kubectl run nginx-prod2 --image=nginx --restart=Never --
labels=env=prod - B. kubectl run nginx-dev1 --image=nginx --restart=Never --
labels=env=dev
kubectl run nginx-dev2 --image=nginx --restart=Never --
labels=env=dev
kubectl run nginx-dev3 --image=nginx --restart=Never --
labels=env=dev
kubectl run nginx-prod1 --image=nginx --restart=Never --
labels=env=prod
kubectl run nginx-prod2 --image=nginx --restart=Never --
labels=env=prod
正解:B
質問 # 43
Create a Cronjob with busybox image that prints date and hello from kubernetes cluster message for every minute
- A. CronJob Syntax:
* --> Minute
* --> Hours
* --> Day of The Month
* --> Month
* --> Day of the Week
*/1 * * * * --> Execute a command every one minutes.
vim date-job.yaml
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: date-job
spec:
schedule: "*/1 * * * *"
jobTemplate:
spec:
template:
- /bin/sh
- -c
- date; echo Hello from the Kubernetes cluster
restartPolicy: OnFailure
kubectl apply -f date-job.yaml
//Verify
kubectl get cj date-job -o yaml - B. CronJob Syntax:
* --> Minute
* --> Hours
* --> Day of The Month
* --> Month
* --> Day of the Week
*/1 * * * * --> Execute a command every one minutes.
vim date-job.yaml
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: date-job
spec:
schedule: "*/1 * * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: hello
image: busybox
args:
- /bin/sh
- -c
- date; echo Hello from the Kubernetes cluster
restartPolicy: OnFailure
kubectl apply -f date-job.yaml
//Verify
kubectl get cj date-job -o yaml
正解:B
質問 # 44
List all the events sorted by timestamp and put them into file.log and verify
- A. kubectl get events --sort-by=.metadata.creationTimestamp
// putting them into file.log
kubectl get events --sort-by=.metadata.creationTimestamp >
cat test-file.log - B. kubectl get events --sort-by=.metadata.creationTimestamp
// putting them into file.log
kubectl get events --sort-by=.metadata.creationTimestamp >
test-file.log
cat test-file.log - C. kubectl get events --sort-by=.metadata.creationTimestamp
kubectl get events --sort-by=.metadata.creationTimestamp >
test-file.log
cat test-file.log
正解:B
質問 # 45
......
CKA別格な問題集で最上級の成績にさせるCKA問題:https://jp.fast2test.com/CKA-premium-file.html
手に入れよう!最新CKA認定の有効な試験問題集解答:https://drive.google.com/open?id=1RvDZG4jdQlvfTKLS3XkRqfreTJhliFv1