Fix issue with LAMP Environment in Kubernetes

@rahul456 @Inderpreet can you please check this for me?thanks.

@Salim Maybe this is the similar issue mentioned in this thread ?

Thanks for the input, I managed to resolve the issue @Inderpreet :slightly_smiling_face:

1 Like

Looks like Kodekloud still give this lab. Got this Aug 2023.
Lab is extremely buggy, did the correct steps multiple times, even followed the suggestions in this thread but lab kept failing. Was about to skip it because I already wasted a day working on it. Left it and returned after an hour, did the same steps again, and voila, it worked. Somehow there is no way to visually verify if the app was deployed successfully - meaning the Wordpress site doesn’t appear. It just showed “Connected successfully”. I added all my notes here for anyone who’s interested to know:

kubectl get deploy
kubectl describe deploy lamp-wp

#will see portno is wrong
kubectl get service

#change port no
kubectl edit service lamp-service

change node port to 30008

kubectl get configmap
kubectl describe configmap eg.php-config

kubectl get deploy
kubectl get pods
kubectl describe pods

kubectl get pods
kubectl exec -it -c httpd-php-container – sh
ls
cd app/
ls
cat index.php

copy index.php
exit
vi index.php
CHANGE HOST-MYSQL to MYSQL_HOST
CHANGE MYSQL_PASSWORDS to MYSQL_PASSWORD

kubectl create configmap --help
kubectl create configmap index --from-file=index.php

kubectl get configmap
#MYSQLHost was updated
kubectl describe configmap index
kubectl edit deployment lamp-wp

below SubPath

  • mountPath: /app/index.php
    name: index
    subPath: index.php

below name: php-config-volume

  • configMap:
    defaultMode: 420
    name: index
    name: index

kubectl get Pods

#mount path was changed after editing
kubectl describe pod

#validate
kubectl exec -it -c httpd-php-container – sh
ls
cd app/
ls
cat index.php