List "nginx-dev" and "nginx-prod" pod and delete those pods
正解:
kubect1 get pods -o wide
kubectl delete po "nginx-dev"
kubectl delete po "nginx-prod"
質問 2:
Set the node named ek8s-node-1 as unavailable and reschedule all the pods running on it.
正解:

質問 3:
Score: 4%

Context
You have been asked to create a new ClusterRole for a deployment pipeline and bind it to a specific ServiceAccount scoped to a specific namespace.
Task
Create a new ClusterRole named deployment-clusterrole, which only allows to create the following resource types:
* Deployment
* StatefulSet
* DaemonSet
Create a new ServiceAccount named cicd-token in the existing namespace app-team1.
Bind the new ClusterRole deployment-clusterrole lo the new ServiceAccount cicd-token , limited to the namespace app-team1.
正解:
Solution:
Task should be complete on node k8s -1 master, 2 worker for this connect use command
[student@node-1] > ssh k8s
kubectl create clusterrole deployment-clusterrole --verb=create --resource=deployments,statefulsets, daemonsets kubectl create serviceaccount cicd-token --namespace=app-team1 kubectl create rolebinding deployment-clusterrole --clusterrole=deployment-clusterrole -- serviceaccount=default:cicd-token --namespace=app-team1
質問 4:
You must connect to the correct host.
Failure to do so may result in a zero score.
[candidate@base] $ ssh Cka000022
Task
Reconfigure the existing Deployment front-end in namespace spline-reticulator to expose port 80/tcp of the existing container nginx .
Create a new Service named front-end-svc exposing the container port 80/tcp .
Configure the new Service to also expose the individual Pods via a NodePort .
正解:
Task Summary
* SSH into cka000022 #
* Modify an existing Deployment:
* Namespace: spline-reticulator
* Deployment: front-end
* Container: nginx
* Expose: port 80/tcp
* Create a Service:
* Name: front-end-svc
* Type: NodePort
* Port: 80 # container port 80
# Step-by-Step Solution
1## SSH into the correct node
ssh cka000022
## Skipping this = zero score
2## Edit the Deployment to expose port 80
kubectl edit deployment front-end -n spline-reticulator
Under containers: # nginx, add this if not present:
ports:
- containerPort: 80
protocol: TCP
# This enables the container to accept traffic on port 80.
3## Create a NodePort Service
Create a file named front-end-svc.yaml:
cat <<EOF > front-end-svc.yaml
apiVersion: v1
kind: Service
metadata:
name: front-end-svc
namespace: spline-reticulator
spec:
type: NodePort
selector:
app: front-end
ports:
- port: 80
targetPort: 80
protocol: TCP
EOF
## Make sure the Deployment has a matching label selector like app: front-end. You can verify with:
kubectl get deployment front-end -n spline-reticulator -o yaml | grep labels -A 2
4## Apply the service
kubectl apply -f front-end-svc.yaml
5## Verify
Check if the service is created and has a NodePort assigned:
kubectl get svc front-end-svc -n spline-reticulator
# You should see something like:
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
front-end-svc NodePort 10.96.0.123 <none> 80:3XXXX/TCP 10s
Where 3XXXX is your automatically assigned NodePort (between 30000-32767).
Final Command Summary
ssh cka000022
kubectl edit deployment front-end -n spline-reticulator
# Add:
# ports:
# - containerPort: 80
cat <<EOF > front-end-svc.yaml
apiVersion: v1
kind: Service
metadata:
name: front-end-svc
namespace: spline-reticulator
spec:
type: NodePort
selector:
app: front-end
ports:
- port: 80
targetPort: 80
protocol: TCP
EOF
kubectl apply -f front-end-svc.yaml
kubectl get svc front-end-svc -n spline-reticulator
質問 5:
Score: 5%

Task
Monitor the logs of pod bar and:
* Extract log lines corresponding to error file-not-found
* Write them to /opt/KUTR00101/bar
正解:
Solution:
kubectl logs bar | grep 'unable-to-access-website' > /opt/KUTR00101/bar cat /opt/KUTR00101/bar
绀野** -
CKA知識の定着を確認しながら学習を進める方式となっていて、合格力が効率的に身に付きます。そういうところもやはりPass4Test素敵だと思う点です