You are on page 1of 11

Kubernetes

Hands-on
Assessment
SENTHIL RAJA CHERMAPANDIAN
Evaluation Procedure
• Google cloud free-tier subscription
• Docker Hub and Github Accounts
Prerequisites • Confirm by starring the kube-fledged github repository

• Implement the hands-on lab scenarios in Google cloud


• Save the session log in a word document
Hands-on
Assessment • Upload the word document to Sharepoint

• Session logs will be reviewed by the Evaluation Panel


Course • Course completion certificate to successful candidates
Completion
1. Pod and ReplicaSet (45 mins)
1. Create a 3-node Kubernetes Cluster on GCP using Kubernetes Engine. Verify you are able to access
the cluster via kubectl

2. Create a Pod named “nginx” with one container running nginx version 1.15.11
1. Find out the IP address of the Pod.
2. Find out in which node the Pod is running
3. Find out the events generates for the Pod.
4. Find out the labels and annotations attached to the Pod.

3. Delete the Pod

4. Create a Replicaset named “rs-nginx” with 2 Pods running nginx v1.14.2


1. Scale out the replicaset to 3 Pods. Verify successful scaling out
2. Scale in the replicaset to 1 Pod. Verify successful scaling in
3. Delete the Pod. Verify the deleted pod is replaced automatically with a new one
2. Services (45 mins)
1. Expose the Pods in “rs-nginx” ReplicaSet using Service type ClusterIP
1. Find out the IP address of the Service. Scale ReplicaSet to 2 Pods
2. Access the Service using Web preview in cloud shell
3. Delete the ClusterIP Service

2. Expose the Pods in “rs-nginx” ReplicaSet using Service type NodePort (port 31575)
1. Find out the IP address of the Service. Scale ReplicaSet to 3 Pods
2. Access the Service using <Node IP>:<Node port> on Browser
3. Delete the NodePort Service

3. Expose the Pods in “rs-nginx” ReplicaSet using Service type LoadBalancer


1. Find out the IP address of the Service
2. Access the Service on using <Load Balancer IP>:<Service Port> on Browser
3. Delete the LoadBalancer Service
3. Volume (30 mins)
1. Create a GCE persistent disk using the following command:-
1. gcloud compute disks create --size=50GB --zone=asia-south1-a my-data-disk (Note: Assumes K8s cluster is
running in zone=asia-south1-a)

2. Create a Pod using “alpine” image that mounts my-data-disk in mountPath = /var/simple
1. Run an infinite sh loop within the container that keeps appending the current date to /var/simple/file.txt every 5
seconds
2. Log into the alpine container and verify the contents of file.txt. Use command kubectl exec <pod name> -i -t -- sh –
il
3. Exit the container. Delete the Pod.

3. Re-create the same Pod. Log into the container. Verify if the contents written by previous Pod are intact.
4. ConfigMap (45 mins)
1. Refer: https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/
1. Create ConfigMap from files in a directory
2. Create ConfigMap from individual files
3. Create ConfigMap from env files
4. Define the key to use when creating a ConfigMap from a file
5. Create ConfigMaps from literal values
6. Define a container environment variable with data from a single ConfigMap
7. Define container environment variables with data from multiple ConfigMaps
8. Populate a Volume with data stored in a ConfigMap
9. Add ConfigMap data to a specific path in the Volume
5. Secrets (30 mins)
1. Refer: https://kubernetes.io/docs/concepts/configuration/secret/
1. Creating a Secret Using kubectl create secret
2. Creating a Secret Manually
3. Decoding a Secret
4. Using Secrets as Files from a Pod
5. Consuming Secret Values from Volumes
6. Using Secrets as Environment Variables
6. Creating a Deployment (30 mins)
1. Create a Deployment that has one nginx:1.14.2 Pod. Add Pod anti-affinity to ensure one Pod per node.

2. Scale the deployment to 3 Pods.

3. Expose the deployment using LoadBalancer Service.

4. Access the application using <Load Balancer IP>:<Service Port>

5. Refer: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#creating-a-
deployment
7. Updating/Rolling back a
Deployment (45 mins)
1. Update the image version of the Deployment to nginx:1.15.11
2. Check out the status of rollout
3. Verify that the rollout created a new ReplicaSet with 3 replicas. And the old ReplicaSet was scaled down to 0
replicas.
4. Verify you are able to access the application successfully
5. Rollback the Deployment to nginx:1.14.2
6. Check the rollout history of a Deployment
7. Rollback to a previous revision in the history
8. Pause and Resume a Deployment
9. Perform both Recreate and RollingUpdate strategies
10.Refer: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/
8. Kube-fledged Add-on (45 mins)
1. A kubernetes add-on for creating and managing a cache of container images directly on the cluster worker
nodes, so application pods start almost instantly
2. Refer to: https://github.com/senthilrch/kube-fledged
3. Deploy the add-on (Quick install using YAML Manifests)
4. Create image cache for nginx and redis images
5. View the status of image cache
6. Add/remove images in image cache
7. On-demand refresh of the image cache
8. Purge the image cache
9. Delete the image cache
10. Remove the add-on
Thank You

- SENTHIL RAJA CHERMAPANDIAN

You might also like