Hi Team, I facing issue with one of the task " Deploying lamp server in Kubernetes cluster"
The Nautilus DevOps team want to deploy a PHP website on Kubernetes cluster. They are going to use Apache as a web server and Mysql for database. The team had already gathered the requirements and now they want to make this website live. Below you can find more details:
Create a config map php-config for php.ini with variables_order = "EGPCS" data.
Create a deployment named lamp-wp.
Create two containers under it. First container must be httpd-php-container using image webdevops/php-apache:alpine-3-php7 and second container must be mysql-container from image mysql:5.6. Mount php-config configmap in httpd container at /opt/docker/etc/php/php.ini location.
.
.
.
etc
The issue is that, I am unable to create a pod with httpd contianer, it shows below error
Error: failed to create containerd task: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting “/var/lib/kubelet/pods/73760fe7-53af-4200-a282-cc15b6a0eae9/volume-subpaths/config-volume/httpd-php-container/0” to rootfs at “/opt/docker/etc/php/php.ini”: mount /var/lib/kubelet/pods/73760fe7-53af-4200-a282-cc15b6a0eae9/volume-subpaths/config-volume/httpd-php-container/0:/opt/docker/etc/php/php.ini (via /proc/self/fd/6), flags: 0x5001: not a directory: unknown
Image: webdevops/php-apache:alpine-3-php7
Image ID: docker.io/webdevops/php-apache@sha256:bb68c986d4947d4cb49e2753a268e33ad3d69df29c8e9a7728090f4738d5bdb9
Port:
Host Port:
State: Waiting
Reason: CrashLoopBackOff
Last State: Terminated
Reason: Error
Exit Code: 1
Started: Thu, 24 Aug 2023 11:08:04 +0000
Finished: Thu, 24 Aug 2023 11:08:04 +0000
Ready: False
Restart Count: 5
Environment Variables from:
mysecret Secret Optional: false
Environment:
Mounts:
/opt/docker/etc/php from php-ini (rw,path=“php.ini”)
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-54wvk (ro)
Conditions:
Type Status
Initialized True
Ready False
ContainersReady False
PodScheduled True
Volumes:
php-ini:
Type: ConfigMap (a volume populated by a ConfigMap)
Name: php-config
Optional: false
kube-api-access-54wvk:
Type: Projected (a volume that contains injected data from multiple sources)
TokenExpirationSeconds: 3607
ConfigMapName: kube-root-ca.crt
ConfigMapOptional:
DownwardAPI: true
QoS Class: BestEffort
Node-Selectors:
Tolerations: node.kubernetes.io/not-ready:NoExecute op=Exists for 300s node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
Type Reason Age From Message
Normal Scheduled 5m11s default-scheduler Successfully assigned default/lamp-wp-7bb964bd46-46wzn to kodekloud-control-plane
Normal Pulled 5m10s kubelet Container image “mysql:5.6” already present on machine
Normal Created 5m10s kubelet Created container mysql-container
Normal Started 5m9s kubelet Started container mysql-container
Normal Started 3m43s (x4 over 5m8s) kubelet Started container httpd-php-container
Warning BackOff 3m6s (x8 over 5m4s) kubelet Back-off restarting failed container httpd-php-container in pod lamp-wp-7bb964bd46-46wzn_default(15b37b1d-a440-43f3-aa77-835c999e029d)
Normal Pulled 2m52s (x5 over 5m9s) kubelet Container image “webdevops/php-apache:alpine-3-php7” already present on machine
Normal Created 2m51s (x5 over 5m9s) kubelet Created container httpd-php-container
kubectl logs lamp-wp-7bb964bd46-46wzn -c httpd-php-container
→ Executing /opt/docker/provision/entrypoint.d/05-permissions.sh
→ Executing /opt/docker/provision/entrypoint.d/20-php-fpm.sh
cp: can’t stat ‘/opt/docker/etc/php/fpm/php-fpm.conf’: No such file or directory
thor@jump_host ~$ k describe pod lamp-wp-7bb964bd46-46wzn