- I am preparing for CKAD exam. I will be adding the hand-on lab excercies I executed during the learning.
- Refer to yml files under apache-https-deployment-service folder to deploy httpd with container port on 80 and expose the httpd service for external access.
- Refer to yml files under petclinic-deployment-service folder to deploy springboot application with container port on 8080 and expose the app for external access.
- Refer to yml files under prometheus-deployment-service folder to deploy Prometheus with container port on 9090 and expose the /metrics for external access.
- Refer to yml files under grafana-deployment-service folder to deploy Grafana with container port on 3000 and expose the dashboard for external access.
- Refer to yml files under configmaps folder to use configmap in pod definition
- Refer to yml files under jenkins-deployment-service folder to deploy Jenkins with container port on 8080 and expose it for external access.
- First time access to Jenkins requires administrator password, follow below steps;
- Logint to one of the pod using command kubectl exec -it jenkins-deploy-5f8969fd59-2qdgs -- bash
- Navitage to Jenkins secrets folder /var/jenkins_home/secrets/
- Copy contents of file cat initialAdminPassword
- Provide the password in Jenkins home page
- First time access to Jenkins requires administrator password, follow below steps;
-
Create a deployment named webapp using the image kodekloud/webapp-color with 3 replicas
- kubectl create deployment webapp --image=kodekloud/webapp-color --replicas=3 --dry-run=client -o yaml > webapp-definition.yaml
-
Expose redis pod on ClusterIP 6379
- kubectl expose pod redis --port=6379 --name=redis-service --dry-run=client -o yaml > redis-service.yaml
-
Deploy Redis pod with image redis:alpine and label tier=db
- kubectl run redis --image=redis:alpine -l tier=db --dry-run=client -o yaml > redis-definition.yaml
-
Create a new namespace called dev-ns
- kubectl create namespace dev-ns --dry-run=client -o yaml > dev-ns-definition.yaml
-
Create a new deployment called redis-deploy in the dev-ns namespace with the redis image. It should have 2 replicas.
- kubectl create deployment redis-deploy -n dev-ns --image=redis --replicas=2 --dry-run=client -o yaml > redis-deploy-definition.yaml
-
Create a pod called httpd using the image httpd:alpine in the default namespace
- kubectl run httpd --image=httpd:alpine
-
Create a service of type ClusterIP by the same name (httpd). The target port for the service should be 80.
- kubectl expose pod httpd --port=80
-
Create a cron job to execute math expression
- kubectl create cronjob math-add-job-cron --schedule="*/1 * * * *" --image=ubuntu --dry-run=client -o yaml -- expr 3 + 2 > cron-job.yaml
-
Create a job to execute math expression
- kubectl create job math-add-job --image=ubuntu --dry-run=client -o yaml -- expr 3 + 2 > job.yaml