Exercise
-
Create a pod named alpine with a single container based on alpine:3.15. This container must run the command
sleep 3600
and have the environment variable token=12345 -
Verify by running a shell in the container and displaying the environment. The variable named token should be present.
-
Delete the pod
Documentation
https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/
Solution
- Create a pod with a single container based on alpine:3.15. This container must run the command
sleep 3600
and have the environment variable token=12345
k run alpine --image=alpine:3.15 --env token=12345 --command sleep 3600
- Verify by running a shell in the container and displaying the environment. The variable named token should be present.
k exec alpine -- env
- Delete the pod
k delete po/alpine