*LIGHTNING LABS, LIGHTNING LAB – 1 - challenge 03:* Hi, I can not run `busybox` . . .

Hubert Wójtowicz:
LIGHTNING LABS, LIGHTNING LAB – 1 - challenge 03:

Hi, I can not run busybox pod for challenge 03 with following instructor.
I am getting crazy there… Please help :pray:
I pod description:

root@controlplane:~# k describe pod time-check 
Name:         time-check
Namespace:    dvl1987
Priority:     0
Node:         controlplane/10.24.51.9
Start Time:   Sat, 21 Aug 2021 15:16:25 +0000
Labels:       <none>
Annotations:  <none>
Status:       Running
IP:           10.50.0.8
IPs:
  IP:  10.50.0.8
Containers:
  time-check:
    Container ID:  <docker://0df97a18168d57c8865101b414d352b360e2df05a1becd1adbfe65db87c6731>c
    Image:         busybox
    Image ID:      <docker-pullable://busybox@sha256>:b37dd066f59a4961024cf4bed74cae5e68ac26b48807292bd12198afa3ecb778
    Port:          &lt;none&gt;
    Host Port:     &lt;none&gt;
    Command:
      /bin/sh
      -C
      while true; do date; sleep $TIME_FREQ;done &gt; /opt/time/time-check.log
    State:          Waiting
      Reason:       CrashLoopBackOff
    Last State:     Terminated
      Reason:       Error
      Exit Code:    2
      Started:      Sat, 21 Aug 2021 15:18:00 +0000
      Finished:     Sat, 21 Aug 2021 15:18:00 +0000
    Ready:          False
    Restart Count:  4
    Environment:
      TIME_FREQ:  &lt;set to the key 'TIME_FREQ' of config map 'time-config'&gt;  Optional: false
    Mounts:
      /opt/time from mydir (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-5l74v (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             False 
  ContainersReady   False 
  PodScheduled      True 
Volumes:
  mydir:
    Type:       EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:     
    SizeLimit:  &lt;unset&gt;
  default-token-5l74v:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-5l74v
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  &lt;none&gt;
Tolerations:     <http://node.kubernetes.io/not-ready:NoExecute|node.kubernetes.io/not-ready:NoExecute> op=Exists for 300s
                 <http://node.kubernetes.io/unreachable:NoExecute|node.kubernetes.io/unreachable:NoExecute> op=Exists for 300s
Events:
  Type     Reason     Age                   From               Message
  ----     ------     ----                  ----               -------
  Normal   Scheduled  2m31s                 default-scheduler  Successfully assigned dvl1987/time-check to controlplane
  Normal   Pulled     2m29s                 kubelet            Successfully pulled image "busybox" in 187.449738ms
  Normal   Pulled     2m27s                 kubelet            Successfully pulled image "busybox" in 313.581274ms
  Normal   Pulled     2m12s                 kubelet            Successfully pulled image "busybox" in 186.959157ms
  Normal   Created    106s (x4 over 2m29s)  kubelet            Created container time-check
  Normal   Pulled     106s                  kubelet            Successfully pulled image "busybox" in 174.629975ms
  Normal   Started    105s (x4 over 2m28s)  kubelet            Started container time-check
  Warning  BackOff    75s (x8 over 2m24s)   kubelet            Back-off restarting failed container
  Normal   Pulling    60s (x5 over 2m29s)   kubelet            Pulling image "busybox"



image.png
image.png

Nuno:
I think that the -C is wrong and it should be -c :thinking_face:

unnivkn:
controlplane $ export do=“–dry-run=client -o yaml”
controlplane $ k run time-check --image=busybox -n dvl1987 $do>4.yaml
controlplane $ k create cm time-config --from-literal=TIME_FREQ=10 -n dvl1987
Error from server (NotFound): namespaces “dvl1987” not found
controlplane $
controlplane $ k create ns dvl1987
namespace/dvl1987 created
controlplane $
controlplane $ k create cm time-config --from-literal=TIME_FREQ=10 -n dvl1987
configmap/time-config created
controlplane $

controlplane $ vim 4.yaml
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
run: time-check
name: time-check
namespace: dvl1987
spec:
volumes:

  • name: myvol
    emptyDir: {}
    containers:
  • image: busybox
    name: time-check
    env:
    # Define the environment variable
    - name: TIME_FREQ
    valueFrom:
    configMapKeyRef:
    # The ConfigMap containing the value you want to assign to SPECIAL_LEVEL_KEY
    name: time-config
    # Specify the key associated with the value
    key: TIME_FREQ
    command: [“/bin/sh”,“-c”,“while true; do date; sleep $TIME_FREQ;done > /opt/time/time-check.log”]
    resources: {}
    volumeMounts:
    • name: myvol
      mountPath: /opt/time
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      status: {}
      controlplane $

controlplane $ k apply -f 4.yaml

controlplane $ k get po -n dvl1987
NAME READY STATUS RESTARTS AGE
time-check 1/1 Running 0 23s
controlplane $

controlplane $ k exec -n dvl1987 time-check – ls -l /opt/time/time-check.log
-rw-r–r-- 1 root root 435 May 27 07:04 /opt/time/time-check.log
controlplane $

controlplane $ k exec -n dvl1987 time-check – tail -f /opt/time/time-check.log
Thu May 27 07:03:02 UTC 2021
Thu May 27 07:03:12 UTC 2021
Thu May 27 07:03:22 UTC 2021
Thu May 27 07:03:32 UTC 2021
Thu May 27 07:03:42 UTC 2021
Thu May 27 07:03:52 UTC 2021
Thu May 27 07:04:02 UTC 2021
Thu May 27 07:04:12 UTC 2021
Thu May 27 07:04:22 UTC 2021
Thu May 27 07:04:32 UTC 2021
^C
controlplane $

Hubert Wójtowicz:
@unnivkn, @Nuno, good catch! Thanks for help! :slightly_smiling_face: I will retry lightening lab once again tomorrow!