Lab- CKA Mock Exam 10 - KodeKloud
Question: We want to deploy a python based application on the cluster using a template located at /root/olive-app-cka10-str.yaml on student-node. However, before you proceed we need to make some modifications to the YAML file as per details given below:
• The YAML should also contain a persistent volume claim with name olive-pvc-cka10-str to claim a 100Mi of storage from olive-pv-cka10-str PV.
• Update the deployment to add a sidecar container, which can use busybox image (you might need to add a sleep command for this container to keep it running.)
• Share the python-data volume with this container and mount the same at path /usr/src. Make sure this container only has read permissions on this volume.
• Finally, create a pod using this YAML and make sure the POD is in Running state.
Troubleshooting:
- Created pvc to claim 100MI
- added a sidecar conatiner and also added sleep command
- Added volume mounts “python-data” on sidecar container with read permission by adding “readOnly: true”
- After this i created the pod and it was in running state.
But the solution is showing as incorrect. Do i need to do anthing else.?
Below is the yaml for deploy
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
deployment.kubernetes.io/revision: "3"
creationTimestamp: "2023-07-05T06:20:43Z"
generation: 3
name: olive-app-cka10-str
namespace: default
resourceVersion: "28177"
uid: fa9f38a2-7f8b-41ba-b13b-a8aa61f6d85e
spec:
progressDeadlineSeconds: 600
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app: olive-app-cka10-str
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
creationTimestamp: null
labels:
app: olive-app-cka10-str
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- cluster1-node01
containers:
- image: poroko/flask-demo-app
imagePullPolicy: Always
name: python
ports:
- containerPort: 5000
protocol: TCP
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /usr/share/
name: python-data
- command:
- /bin/sh
- -c
- sleep 10000
image: busybox
imagePullPolicy: Always
name: sidecar
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /usr/src/
name: python-data
readOnly: true
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
volumes:
- name: python-data
persistentVolumeClaim:
claimName: olive-pvc-cka10-str
status:
availableReplicas: 1
conditions:
- lastTransitionTime: "2023-07-05T07:05:31Z"
lastUpdateTime: "2023-07-05T07:05:31Z"
message: Deployment has minimum availability.
reason: MinimumReplicasAvailable
status: "True"
type: Available
- lastTransitionTime: "2023-07-05T06:20:43Z"
lastUpdateTime: "2023-07-05T07:14:40Z"
message: ReplicaSet "olive-app-cka10-str-cd64f8b48" has successfully progressed.
reason: NewReplicaSetAvailable
status: "True"
type: Progressing
observedGeneration: 3
readyReplicas: 1
replicas: 1
updatedReplicas: 1