Fix issue with LAMP Environment in Kubernetes

Hi @rahul456 @Tej-Singh-Rana @Inderpreet,

I also faced similar issue with the task. Has sent to review as well but didnt got anything fruitful. Can you please check and confirm what is the issue.

  • changed the port on the lamp-service
  • recorrected the db env mistake
  • added DB_HOST to the env of the deployment, but still getting the wp installation page.

Task failed:
‘wordpress’ is not working

thor@jump_host ~$ kubectl get deploy,pod,svc

NAME                      READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/lamp-wp   1/1     1            1           7m28s

NAME                          READY   STATUS    RESTARTS   AGE
pod/lamp-wp-d6b8b686c-t5vqd   2/2     Running   0          9s

NAME                    TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE
service/kubernetes      ClusterIP      10.96.0.1       <none>        443/TCP          8m3s
service/lamp-service    LoadBalancer   10.106.112.86   <pending>     80:30008/TCP     7m28s
service/mysql-service   LoadBalancer   10.109.1.251    <pending>     3306:30009/TCP   7m28s
thor@jump_host ~$ POD=$(kubectl get pods -o=jsonpath='{.items[*].metadata.name}')
thor@jump_host ~$ HTTP=$(kubectl get pod  -o=jsonpath='{.items[*].spec.containers[0].name}') ; echo "HTTP: $HTTP"
HTTP: httpd-php-wp-container
thor@jump_host ~$ MYSQL=$(kubectl get pod -o=jsonpath='{.items[*].spec.containers[1].name}')  ; echo "MYSQL: $MYSQL"
MYSQL: mysql-container
thor@jump_host ~$ kubectl exec -it $POD -c $HTTP -- env | grep -i mysql
MYSQL_USER=kodekloud_gem
MYSQL_PASSWORD=Rc5C9EyvbU
MYSQL_HOST=mysql-service
MYSQL_ROOT_PASSWORD=R00t
MYSQL_DATABASE=kodekloud_db2
MYSQL_SERVICE_SERVICE_PORT=3306
MYSQL_SERVICE_PORT_3306_TCP=tcp://10.109.1.251:3306
MYSQL_SERVICE_PORT_3306_TCP_ADDR=10.109.1.251
MYSQL_SERVICE_PORT_3306_TCP_PROTO=tcp
MYSQL_SERVICE_PORT_3306_TCP_PORT=3306
MYSQL_SERVICE_SERVICE_HOST=10.109.1.251
MYSQL_SERVICE_PORT=tcp://10.109.1.251:3306
thor@jump_host ~$ kubectl exec -it $POD -c $MYSQL -- env | grep -i mysql
MYSQL_ROOT_PASSWORD=R00t
MYSQL_DATABASE=kodekloud_db2
MYSQL_USER=kodekloud_gem
MYSQL_PASSWORD=Rc5C9EyvbU
MYSQL_HOST=mysql-service
MYSQL_SERVICE_PORT_3306_TCP=tcp://10.109.1.251:3306
MYSQL_SERVICE_PORT_3306_TCP_ADDR=10.109.1.251
MYSQL_SERVICE_SERVICE_PORT=3306
MYSQL_SERVICE_PORT_3306_TCP_PORT=3306
MYSQL_SERVICE_SERVICE_HOST=10.109.1.251
MYSQL_SERVICE_PORT_3306_TCP_PROTO=tcp
MYSQL_SERVICE_PORT=tcp://10.109.1.251:3306
MYSQL_MAJOR=5.6
MYSQL_VERSION=5.6.48-1debian9
thor@jump_host ~$ kubectl describe pod | grep -A 6 Env
    Environment:
      MYSQL_ROOT_PASSWORD:  <set to the key 'password' in secret 'mysql-root-pass'>  Optional: false
      MYSQL_DATABASE:       <set to the key 'database' in secret 'mysql-db-url'>     Optional: false
      MYSQL_USER:           <set to the key 'username' in secret 'mysql-user-pass'>  Optional: false
      MYSQL_PASSWORD:       <set to the key 'password' in secret 'mysql-user-pass'>  Optional: false
      MYSQL_HOST:           <set to the key 'host' in secret 'mysql-host'>           Optional: false
    Mounts:
--
    Environment:
      MYSQL_ROOT_PASSWORD:  <set to the key 'password' in secret 'mysql-root-pass'>  Optional: false
      MYSQL_DATABASE:       <set to the key 'database' in secret 'mysql-db-url'>     Optional: false
      MYSQL_USER:           <set to the key 'username' in secret 'mysql-user-pass'>  Optional: false
      MYSQL_PASSWORD:       <set to the key 'password' in secret 'mysql-user-pass'>  Optional: false
      MYSQL_HOST:           <set to the key 'host' in secret 'mysql-host'>           Optional: false
    Mounts:
thor@jump_host ~$ kubectl exec -it $POD -c $HTTP -- cat wp-config.php | grep ENV
define( 'DB_NAME', $_ENV['MYSQL_DATABASE'] );
define( 'DB_USER', $_ENV['MYSQL_USER'] );
define( 'DB_PASSWORD', $_ENV['MYSQL_PASSWORD'] );
define( 'DB_HOST', $_ENV['MYSQL_HOST']);
thor@jump_host ~$ kubectl exec -it $POD -c $MYSQL -- bash
root@lamp-wp-d6b8b686c-t5vqd:/# mysql -u kodekloud_gem -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.48 MySQL Community Server (GPL)

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| kodekloud_db2      |
+--------------------+
2 rows in set (0.00 sec)

mysql>
Reply

@mmumshad @rahul456 @Ayman @kodekloud-support3
So this is gonna be the fourth day task i lose because of this pending issue. I think this is a bit unfair at least we should have been asigned tasks for the days lost. We cant compete with other fellews if it goes like this.

@nashwan, you have been assigned another task instead of this one, we are investigating issue further. Please proceed with the upcoming tasks.

@rahul456 i am not getting any tasks since that is in pending status. And lost four days task you only asinged one task to me two days ago. Please check my profile to see since when i havent been asigned any tasks.

@mmumshad @rahul456 @Inderpreet I haven’t been assigned any task for the following days because of the issue with this task:

  • Task for 11th November (not been assigned)
  • Task for 12th November (not been assigned)
  • Task for 13th November (Manually assigned, thank you)
  • Task for 14th November (not been assigned)
  • Task for 15th November (not been assigned)

I am literally seeing my other fellow passing through and I am stuck there without tasks. Please fix this for me. you can either change the pending task with issue to success or remove it from my bucket. and please compensate the tasks for the lost dates mentioned above.

@nashwan, you should have new task assigned in your bucket.

thanks @rahul456 that is would be task for 15th Nov. yet to get the lost task for other days please?

@rahul456 apologies for nagging on this issue many times, but the task is still pending, I think that is preventing us from getting new tasks. so if you can remove it from our bucket until it get fixed. or should we proceed with the task and you guys can mark it as success?

I saw 3-4 types of questions related to LAMP stack. All are failing :frowning: I faced another one today and this task also had a similar problem :frowning:

@Ayman Will, you check and mark all my lamp stack tasks to available state?

@nashwan, that issue task was marked as expired and new task was also assgined to you 3 days before.

@rahul456 actually you marked a review reward as expired.plus you shouldnt mark it as expired instead remove it from my bucket because that will show another incomplete task in my bucket which is not fair. Would be great if you remove it and please revert the reward point to which you marked it as expired

Also because of this issue i only got two task from.10 to 18th nov. This is really not fair. But if you think i only deserver to be treated this way. I cant do anything but will indeed be disappointed.
.

@nashwan, marked success for you.

Thanks @rahul456 but i can still see it as pending. You may have recorrected the review reward points which i got it for reviwing others task.but not mark this task as success. Its still showing pending.

@nashwan, please check once, if that task success ?

@rahul456, Can I get an answer on my request too? Did you checked my task ? Can I get an input too?

@kleansoul, can you please share your KKE user details ?

@kleansoul, this is marked success for you.

1 Like

@rahul456 Thanks for your reply.

@rahul456 yes its marked as success, but I donot know why this task is marked as expired?

Reviewed for MS : Fix issue with LAMP Environment in Kubernetes Nov 13, 2020 12:32:00 AM
200
Expired

( can you please re-correct his as well)

@rahul456 Will you please review and assing back my tasks too? I faced lamp stack tasks more than 6 times :slight_smile:

@rahul456 I was able to load the WordPress but the validation said there is something wrong with environment variables. I have also submitted the task for review

Wordpress website





mysql container environment variables in a deployment:

Regards,
Salim