Game of pod #1 - Issue with command - argument

Hello,

In the game of pod #1, I Don’t manage to validate the command and argument for the creation of the Drupal pod (the web server)

I have put this :

But it still does not validate it…

And after many test it does not validate it. I came to the point that I suspect that the validation would be in error.

Can you please help ?

Anyway thanks for this great lab !! I enjoy it a lot…

Cyril

try this one
'cp -r /var/www/html/sites/ /data/ && chown -R www-data:www-data /data/'

Thanks,

Still not working… Strange…

Cyril

what is the error? can you share image of your error o/p ?

this is working fine from my side. I have attended this task and working fine.
your screen shot commands working fine.

Here is the Screenshot :slight_smile:

image

I still Don’t manage to have the green check for validation

When I describe the pod it seems to work :

Command:
  /bin/bash
  -c
Args:
  cp -r /var/www/html/sites/ /data/ && chown -R www-data:www-data /data/
State:          Terminated
  Reason:       Completed
  Exit Code:    0

Thanks for your help,

Cyril

apiVersion: apps/v1
kind: Deployment
metadata:
  name: drupal
  labels:
    app: drupal
spec:
  replicas: 1
  selector:
    matchLabels:
      app: drupal
  template:
    metadata:
      name: drupal
      labels:
        app: drupal
    spec:
      containers:
        - name: drupal
          image: drupal:8.6
          volumeMounts:
            - mountPath: /var/www/html/modules
              name: module
              subPath: modules
            - mountPath: /var/www/html/profiles
              name: profile
              subPath: profiles
            - mountPath: /var/www/html/sites
              name: site
              subPath: sites
            - mountPath: /var/www/html/themes
              name: theme
              subPath: themes
      volumes:
        - name: module
          emptyDir: {}
        - name: profile
          emptyDir: {}
        - name: site
          emptyDir: {}
        - name: theme
          emptyDir: {}  
        - name: data
          emptyDir: {}
        - name: hostpath
          hostPath:
            path: /drupal-data
            type: DirectoryOrCreate  
        - name: my-vol
          persistentVolumeClaim:
            claimName: drupal-pvc
      initContainers:
        - name: init-sites-volume
          image: drupal:8.6
          volumeMounts:
            - mountPath: /data
              name: data
          command: [ "/bin/bash", "-c" ]
          args: [ 'cp -r /var/www/html/sites/ /data/; chown www-data:www-data /data/ -R' ]
              

Can you post the status of the pod , specifically the init Container, did it complete successfully?

Now it is working… but I Don’t know why…

Regarding your questions, here was the output when it was not working :slight_smile:

Anyway thanks for your help !

Name: drupal-774b56cfd6-tpmjd
Namespace: default
Priority: 0
PriorityClassName:
Node: node01/172.17.0.49
Start Time: Sun, 17 May 2020 12:03:18 +0000
Labels: app=drupal
pod-template-hash=3306127982
Annotations:
Status: Running
IP: 10.32.0.2
Controlled By: ReplicaSet/drupal-774b56cfd6
Init Containers:
init-sites-volume:
Container ID: docker://6e49fe90dd538c7d52a5db11c312fd6b1f6a685c25d6634cd61e5d1affa8725b
Image: drupal:8.6
Image ID: docker-pullable://drupal@sha256:6b33b1f96b13aab3c4280fa8362a6fb32194b2656191b5c9b85f2cb014a8d942
Port:
Host Port:
Command:
/bin/bash
-c
Args:
cp -r /var/www/html/sites/ /data/ && chown -R www-data:www-data /data/
State: Terminated
Reason: Completed
Exit Code: 0
Started: Sun, 17 May 2020 12:03:41 +0000
Finished: Sun, 17 May 2020 12:03:41 +0000
Ready: True
Restart Count: 0
Environment:
Mounts:
/data from pvc (rw)
/var/run/secrets/kubernetes.io/serviceaccount from default-token-gm9wt (ro)
Containers:
drupal:
Container ID: docker://24d3dfa9d71a5a7893ed9cd390f0fb08d7c822afdc33376ef2d9f2bb7e9b0c60
Image: drupal:8.6
Image ID: docker-pullable://drupal@sha256:6b33b1f96b13aab3c4280fa8362a6fb32194b2656191b5c9b85f2cb014a8d942
Port:
Host Port:
State: Running
Started: Sun, 17 May 2020 12:03:42 +0000
Ready: True
Restart Count: 0
Environment:
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from default-token-gm9wt (ro)
/var/www/html/modules from pvc (rw)
/var/www/html/profiles from pvc (rw)
/var/www/html/sites from pvc (rw)
/var/www/html/themes from pvc (rw)
Conditions:
Type Status
Initialized True
Ready True
ContainersReady True
PodScheduled True
Volumes:
pvc:
Type: PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
ClaimName: drupal-pvc
ReadOnly: false
default-token-gm9wt:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-gm9wt
Optional: false
QoS Class: BestEffort
Node-Selectors:
Tolerations: node.kubernetes.io/not-ready:NoExecute for 300s
node.kubernetes.io/unreachable:NoExecute for 300s
Events:
Type Reason Age From Message


Normal Scheduled 5m default-scheduler Successfully assigned default/drupal-774b56cfd6-tpmjd to node01
Normal Pulling 5m kubelet, node01 pulling image “drupal:8.6”
Normal Pulled 4m kubelet, node01 Successfully pulled image “drupal:8.6”
Normal Created 4m kubelet, node01 Created container
Normal Started 4m kubelet, node01 Started container
Normal Pulled 4m kubelet, node01 Container image “drupal:8.6” already present on machine
Normal Created 4m kubelet, node01 Created container
Normal Started 4m kubelet, node01 Started container

1 Like