[2024年04月28日]CKA究極な学習ガイド [Q34-Q51]

Share

[2024年04月28日]CKA究極な学習ガイド

究極なガイドで準備CKA認定試験Kubernetes Administratorは2024年更新

質問 # 34
Scale the deployment webserver to 6 pods.

正解:

解説:
solution


質問 # 35
Undo/Rollback deployment to specific revision "1"

  • A. // Check Deployment History
    kubectl rollout history deployment webapp
    //Rollback to particular revision
    kubectl rollout undo deploymet webapp --to-revision=1
  • B. // Check Deployment History
    kubectl rollout history deployment webapp
    kubectl rollout undo deploymet webapp --to-revision=1

正解:A


質問 # 36
List the nginx pod with custom columns POD_NAME and POD_STATUS

正解:

解説:
kubectl get po -o=custom-columns="POD_NAME:.metadata.name, POD_STATUS:.status.containerStatuses[].state"


質問 # 37
Create a namespace called 'development' and a pod with image nginx called nginx on this namespace.

正解:

解説:
kubectl create namespace development
kubectl run nginx --image=nginx --restart=Never -n development


質問 # 38
Score: 4%

Task
Schedule a pod as follows:
* Name: nginx-kusc00401
* Image: nginx
* Node selector: disk=ssd

正解:

解説:
See the solution below.
Explanation
Solution:
#yaml
apiVersion: v1
kind: Pod
metadata:
name: nginx-kusc00401
spec:
containers:
- name: nginx
image: nginx
imagePullPolicy: IfNotPresent
nodeSelector:
disk: spinning
#
kubectl create -f node-select.yaml


質問 # 39
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.

正解:

解説:
Solution:



質問 # 40
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.

正解:

解説:
See the solution below.
Explanation
solution
F:\Work\Data Entry Work\Data Entry\20200827\CKA\5 B.JPG

F:\Work\Data Entry Work\Data Entry\20200827\CKA\5 C.JPG

F:\Work\Data Entry Work\Data Entry\20200827\CKA\5 D.JPG


質問 # 41
Monitor the logs of pod foo and:
Extract log lines corresponding to error
unable-to-access-website
Write them to /opt/KULM00201/foo

正解:

解説:
solution


質問 # 42
Undo the deployment to the previous version 1.17.1 and verify Image has the previous version

正解:

解説:
kubectl rollout undo deploy webapp kubectl describe deploy webapp | grep Image


質問 # 43
List all persistent volumes sorted bycapacity, saving the fullkubectloutput to
/opt/KUCC00102/volume_list. Usekubectl 's own functionality forsorting the output, and do not manipulate it any further.

正解:

解説:
See the solution below.
Explanation
solution


質問 # 44
Print pod name and start time to "/opt/pod-status" file

正解:

解説:
kubect1 get pods -o=jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.status.podIP}{"\n"}{end}'


質問 # 45
Get list of all pods in all namespaces and write it to file "/opt/pods-list.yaml"

正解:

解説:
kubectl get po -all-namespaces > /opt/pods-list.yaml


質問 # 46
Score: 5%

Task
From the pod label name=cpu-utilizer, find pods running high CPU workloads and write the name of the pod consuming most CPU to the file /opt/KUTR00401/KUTR00401.txt (which already exists).

正解:

解説:
See the solution below.
Explanation
Solution:
kubectl top -l name=cpu-user -A
echo 'pod name' >> /opt/KUT00401/KUT00401.txt


質問 # 47
Check the history of deployment

正解:

解説:
kubectl rollout history deployment webapp


質問 # 48
List all the pods showing name and namespace with a json path expression

正解:

解説:
kubectl get pods -o=jsonpath="{.items[*]['metadata.name', 'metadata.namespace']}"


質問 # 49
Create a persistent volume with nameapp-data, of capacity2Giandaccess modeReadWriteMany. Thetype of volume ishostPathand itslocation is/srv/app-data.

正解:

解説:
See the solution below.
Explanation
solution
Persistent Volume
A persistent volume is a piece of storage in aKubernetes cluster. PersistentVolumes are a cluster-level resource like nodes, which don't belong to any namespace. It is provisioned by the administrator and has a particular file size. This way, a developer deploying their app on Kubernetes need not knowthe underlying infrastructure.
When the developer needs a certain amount of persistent storage for their application, the system administrator configures the cluster so that they consume the PersistentVolume provisioned in an easy way.
Creating PersistentVolume
kind: PersistentVolumeapiVersion: v1metadata:name:app-dataspec:capacity: # defines the capacity of PV we are creatingstorage:2Gi#the amount of storage we are tying to claimaccessModes: # defines the rights of the volumewe are creating-ReadWriteManyhostPath:path: "/srv/app-data" # path to which we are creating the volume Challenge
* Create a Persistent Volume named ReadWriteMany, storage classname
shared,2Giof storage capacity and the host path

2. Save the file and create the persistent volume.
Image for post

3. View the persistent volume.

* Our persistent volume status is available meaning it is available and it has not been mounted yet. This status willchange when we mount the persistentVolume to a persistentVolumeClaim.
PersistentVolumeClaim
In a real ecosystem, a system admin will create the PersistentVolume then a developer will create a PersistentVolumeClaim which will be referenced in a pod. A PersistentVolumeClaim is created by specifying the minimum size and the access mode they require from the persistentVolume.
Challenge
* Create a Persistent Volume Claim that requests the Persistent Volume we had created above. The claim should request 2Gi. Ensurethat the Persistent Volume Claim has the same storageClassName as the persistentVolume you had previously created.
kind: PersistentVolumeapiVersion: v1metadata:name:
spec:
accessModes:-ReadWriteManyresources:
requests:storage:2Gi
storageClassName:shared
2. Save and create the pvc
njerry191@cloudshell:~(extreme-clone-2654111)$ kubect1 create -f app-data.yaml persistentvolumeclaim/app-data created
3. View the pvc
Image for post

4. Let's see what has changed in the pv we had initially created.
Image for post

Our status has now changed fromavailabletobound.
5. Create a new pod named myapp with image nginx that will be used to Mount the Persistent Volume Claim with the path /var/app/config.
Mounting a Claim
apiVersion: v1kind: Podmetadata:creationTimestamp: nullname: app-dataspec:volumes:- name:congigpvcpersistenVolumeClaim:claimName: app-datacontainers:- image: nginxname:
appvolumeMounts:- mountPath: "


質問 # 50
Create a pod that having 3 containers in it? (Multi-Container)

  • A. 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
    labels:
    run: multi-container
    name: multi-container
    spec:
    containers:
    - image: nginx
    name: nginx-container
    - image: redis
    name: consul-container
    restartPolicy: Always
  • B. 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

正解:B


質問 # 51
......

Kubernetes Administrator基礎問題CKA試験練習問題集:https://www.jpntest.com/shiken/CKA-mondaishu

弊社を連絡する

我々は12時間以内ですべてのお問い合わせを答えます。

オンラインサポート時間:( UTC+9 ) 9:00-24:00
月曜日から土曜日まで

サポート:現在連絡