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