Q1. Create a Multi-container Pod
with name multi-c-pod
, which contains containers from following images :-
- image1 : nginx:alpine
- image2 : redis
- image3 : memcached
You can have container names, as per your choice.
Q2. Create a Namespace
with name mynamespace
using YAML. Create a Pod
with name mypod
using nginx:alpine
image, inside this mynamespace
namespace.
- image : nginx:alpine
- name : nginx-rs
- label : app=ckad
- replicas : 3
Q4. Create 2 pods as follow and perform Set Based Requirement
Label selector operations given below and save all the commands and the outputs to ~/label.txt
.
-
A. Create a
Pod
with nameprod-pod
- image : nginx:alpine
- name : prod-pod
- label : environment=production,tier=frontend
-
B. Create a
Pod
with namedev-pod
- image : nginx:alpine
- name : dev-pod
- label : environment=dev,tier=backend
-
C. List the Pods using
Set Based Requirement
Label selector for following conditions:- List the pods which exist in
production
environment. - List the Pods which does not exist in
production
environment. - List he Pods which does not exist in
qa
environment.
- List the pods which exist in
- image : nginx:alpine
- name : nginx-ds
- label : app=ds-app
- nodeselector: disk=ssd
- image : nginx:alpine
- name : nginx-deploy
- label : app=web
- replicas : 3
Q4. Update the image for Pods
in Deployment
nginx-deploy
to nginx:stable
. Save rollout history to ~/rollout.txt
Q5. Create Pod
with name healthy-pod
and configure the readiness and liveness probe for it. Use following configuration while creating the pods.
-
name: healthy-pod
-
image: nginx
-
Liveness Probe
- initial delay for liveness probe: 5 seconds
- timeout for liveness probe: 1 second
- kubelet should perform a liveness probe every 3 seconds
- maximum restarts: 5
-
Liveness Probe
- initial delay for readiness probe: 5 seconds
- timeout for readiness probe: 1 second
- kubelet should perform a readiness probe every 3 seconds
- maximum restarts: 7
- name: mypv
- size: 5gb
- volumedriver: Hostpath
- Retain policy: recycle
Q2. Create Persistent Volume Claim
with name mypvc
which consume Persistent Volume
mypv
Using YAML such that:
- name: mypvc
- size: 2gb
Q3. Create a Pod with name mypvpod
from ubuntu
image, which will mount the Persistent Volume Claim
mypvc
at mount path /data
such that:
- name: mypvpod
- image: ubuntu
- PVC: mypvc
- mountpath: /data
Q4. Create a Pod
named non-persistent-redis
from redis
image that have a volume with name app-cache
, and mountpath will be /data/redis
. It should launch in the staging
namespace and the volume MUST NOT be persistent.
Q1. Create Pod name init-demo
which have one init container with name init-ctr
which will write a file and another container with name app-ctr
will check whether that file is exist or not. You can choose any container images of your choice for creating the init container
and container
.
- USERNAME: cloudyuga
- PASSWORD: CloudyugaCKA
Q3. Create a Pod
with name mysecretpod
which will be consuming the secret mysecret
as enviorment variable TOPSECRETUSERNAME
will have value of USERNAME
and enviorment variable TOPSECRETPASSWORD
will have value of PASSWORD
. You can use any image of your choice for creating pod.
- Put memory limits of 256Mi on the namespace.
- Limit pods to 2 persistent volumes in this namespace.
- Run a pod with name
test-pod
in thetest-quota
namespace with resource request and limit which satisfy the resource quota. You can use image of your choice to create the pod.
Q1. Create an Deployment
with name deploy-app
and create service for that deployment svc-app
. Deploy Ingress controller and create Ingress resource app-ing
such that app.example.com
resolve to service svc-app
.
- name of Deployment: deploy-app
- image: nginx:alpine
- labels: app=nginx-deploy
- replicas: 3
- name of Service: svc-app
- name of ingress object: app-ing
- name of Deployment: nginx-deploy
- image: nginx:alpine
- labels: app=nginx-deploy
- replicas: 4
- name of Service: nginx-svc
- type of service: NodePort
- NodePort: 31089
Q4. Create a Pod
with name test
and ClusterIP service with name test-svc
for accessing this test
pod using YAML:
-
Pod configuration:
- Name of Pod: test
- image: nginx
- labels: app=test-app
-
Service Configuration:
- Name of service: test-svc
- service type: ClusterIP
Q5: Get the DNS records for test
Pod
and test-svc
service
. and store it at ~/testpod.txt
and ~/testsvc.txt
respectively.
Q1. Create a Namespace
with name demo
in this namespace create Pod
with namedemo
. Create a Namespace
with name test
in this namespace create Pod
with nametest
. Create a Network Policy in such way that It should allow traffic to the demo
pod only from test
pod running in test
namespace. You can use any image of your choice to create the pods.
Q2. Creare a namespace called secure
, in that namespace create Pod with name sec-pod
which is running with UID 2000 and GID 2000. You can use any image of your choice to create the pods.
Q3. Create a new Namespace
called demo-sa
. In that demo-sa
Namespace create Service Account
with name demo
using YAML. Now in the Namespace demo-sa
, create a Pod
demo-pod
using YAML as following configuration:
- name: demo-pod
- namespace: demo-ns
- serviceaccount: demo
- image: nginx:alpine
- lable: app=demo-app