Kubernetes Lab 2 - Pod Configuration
Problem
- Create a pod definition named
yoda-service-pod.yml, and then create a pod in the cluster using this definition to make sure it works.
The specifications are as follows:
- The current image for the container is
bitnami/nginx. You do not need a custom command or args. - There is some configuration data the container will need:
yoda.baby.power=100000000yoda.strength=10
- It will expect to find this data in a file at
/etc/yoda-service/yoda.cfg. Store the configuration data in a ConfigMap calledyoda-service-configand provide it to the container as a mounted volume. - The container should expect to use
64Miof memory and250mCPU (use resource requests). - The container should be limited to
128Miof memory and500mCPU (use resource limits). - The container needs access to a database password in order to authenticate with a backend database server. The password is
0penSh1ftRul3s!. It should be stored as a Kubernetes secret calledyoda-db-passwordand passed to the container as an environment variable calledDB_PASSWORD. - The container will need to access the Kubernetes API using the ServiceAccount
yoda-svc. Create the service account if it doesn’t already exist, and configure the pod to use it.
Verification
To verify your setup is complete, check /etc/yoda-service for the yoda.cfg file and use the cat command to check it’s contents.
kubectl exec -it yoda-service /bin/bashcd /etc/yoda-servicecat yoda.cfg