madhusmita:
For the LIGHTNING LAB – 1,
Create a pod called time-check in the dvl1987 namespace. This pod should run a container called time-check that uses the busybox image.
> Create a config map called time-config with the data TIME_FREQ=10 in the same namespace.
The time-check container should run the command: while true; do date; sleep $TIME_FREQ;done and write the result to the location /opt/time/time-check.log.
The path /opt/time on the pod should mount a volume that lasts the lifetime of this pod.
Pod time-check
configured correctly?
I created the namespace dvl1987 and time-config in dvl1987 namespace.
The yaml for pod is:
apiVersion: v1
kind: Pod
metadata:
labels:
run: time-check
name: time-check
namespace: dvl1987
spec:
containers:
- image: busybox
name: time-check
env:
# Define the environment variable- name: TIME_FREQ
valueFrom:
configMapKeyRef:
name: time-config
key: TIME_FREQ
command: [“/bin/sh”]
args: [“-c”, “while true; do date; sleep $TIME_FREQ;done”]
volumeMounts: - name: config-vol
mountPath: /opt/time
volumes: - name: config-vol
emptyDir: {}
- name: TIME_FREQ
it creates the pod and when I check the date in the container, it shows me the date. The env variable is set in the container. But answer says it is incorrect. Coudl you tell me what is wrong in the creating pod here?