Running pods in kubernetes
Trail 1
- Run an alpine container in a pod which goes into exited state immedietly Refer Here for the changes
- Now lets apply the manifest
- as we know the container will endup in exited state. k8s is trying to restart the container to maintained the desired state. It keeps restarting and if the container doesnot start, it sets the state to CrashloopBackoff and keeps restarting

Trail 2
- Run an alpine contianer with sleep 1d as CMD. Refer Here for the changes
- Lets apply the manifest

- If we want execute any command in the container
- Docker
docker container exec - k8s
kubectl exec <pod> -- <cmd>

- Docker
- Exercise: findout a way to login into specific contianer in a pod
used when you multi contianer pods
Trail 3
- Run an mysql contianer and pass environmental variables to set username, root password, password, database
- docker command
docker container run -d --name trail3 -e MYSQL_ROOT_PASSWORD=admin123 -e MYSQL_DATABASE=emp -e MYSQL_USER=nop -e MYSQL_PASSWORD=admin123 mysql:8.0-debian
-
Refer Here for the k8s manifest

- Exercise: try creating any other database pod (postgres, sqlserver on linux, oracle)
Trail 4
- Figure out a docker command to create jenkins container with
- 1 vcpu
- 512 mb of RAM
- Also using docker stats view what has been attached to container
- Google: soft limit hard limit
- Concepts: Resource Management Refer Here
- Requests
- Limits
- Lets write the kuberentes manifest to create a jenkins container in it with
- request: 0.5 cpu , 256 Mi
- limit: 1 cpu, 1 GB
- Refer Here for the manifest


