SIMULATION
Create a pod that having 3 containers in it? (Multi-Container)
Answer : 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
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
SIMULATION
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.
Answer : A
solution



SIMULATION

Task
Create a new HorizontalPodAutoscaler (HPA ) named apache-server in the autoscale
namespace. This HPA must target the existing Deployment called apache-server in the
autoscale namespace.
Set the HPA to aim for 50% CPU usage per Pod . Configure it to have at least 1 Pod and no more than 4 Pods . Also, set the downscale stabilization window to 30 seconds.
Answer : A, A
Task Summary
Create an HPA named apache-server in the autoscale namespace.
Target an existing deployment also named apache-server.
CPU target: 50%
Pod range: min 1, max 4
Downscale stabilization window: 30 seconds
Step-by-Step Answer
Step 1: Connect to the correct host
This is critical, as shown in the warning image.
ssh cka000050
Skipping this may result in zero for this question!
Step 2: Verify the deployment exists
kubectl get deployment apache-server -n autoscale
Make sure it's there before creating the HP
SIMULATION
List all the pods showing name and namespace with a json path expression
Answer : A
kubectl get pods -o=jsonpath='{.items[*]['metadata.name',
'metadata.namespace']}'
SIMULATION
Schedule a Pod as follows:
. Name: kucc1
. App Containers : 2
. Container Name/Images :
redis
Memcached
Answer : A

SIMULATION
Score: 4%

Task
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 .
Answer : A
Solution:
kubectl run kucc8 --image=nginx --dry-run -o yaml > kucc8.yaml
# vi kucc8.yaml
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
name: kucc8
spec:
containers:
- image: nginx
name: nginx
- image: redis
name: redis
- image: memcached
name: memcached
- image: consul
name: consul
#
kubectl create -f kucc8.yaml
#12.07
SIMULATION
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 .
Answer : A
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