Mysql and Wordpress Kubernetes installtion giving Name Resolution Error

I am trying to install wordpress on kubernetes using NFS as a persistent volume.
so far I have followed steps from below link.

Install Wordpress

I am able to successfully install the mysql and mysql Pod displays the below messages.

MySQL init process done. Ready for start up.

2019-03-11 12:23:54 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-03-11 12:23:54 0 [Note] mysqld (mysqld 5.6.43) starting as process 1 ...
2019-03-11 12:23:54 1 [Note] Plugin 'FEDERATED' is disabled.
2019-03-11 12:23:54 1 [Note] InnoDB: Using atomics to ref count buffer pool pages
2019-03-11 12:23:54 1 [Note] InnoDB: The InnoDB memory heap is disabled
2019-03-11 12:23:54 1 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-03-11 12:23:54 1 [Note] InnoDB: Memory barrier is not used
2019-03-11 12:23:54 1 [Note] InnoDB: Compressed tables use zlib 1.2.11
2019-03-11 12:23:54 1 [Note] InnoDB: Using Linux native AIO
2019-03-11 12:23:54 1 [Note] InnoDB: Using CPU crc32 instructions
2019-03-11 12:23:54 1 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2019-03-11 12:23:54 1 [Note] InnoDB: Completed initialization of buffer pool
2019-03-11 12:23:54 1 [Note] InnoDB: Highest supported file format is Barracuda.
2019-03-11 12:23:54 1 [Note] InnoDB: 128 rollback segment(s) are active.
2019-03-11 12:23:54 1 [Note] InnoDB: Waiting for purge to start
2019-03-11 12:23:54 1 [Note] InnoDB: 5.6.43 started; log sequence number 1625997
2019-03-11 12:23:54 1 [Note] Server hostname (bind-address): '*'; port: 3306
2019-03-11 12:23:54 1 [Note] IPv6 is available.
2019-03-11 12:23:54 1 [Note]   - '::' resolves to '::';
2019-03-11 12:23:54 1 [Note] Server socket created on IP: '::'.
2019-03-11 12:23:54 1 [Warning] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2019-03-11 12:23:54 1 [Warning] 'proxies_priv' entry '@ root@mysql-65db44d76-ss9g7' ignored in --skip-name-resolve mode.
2019-03-11 12:23:54 1 [Note] Event Scheduler: Loaded 0 events
2019-03-11 12:23:54 1 [Note] mysqld: ready for connections.
Version: '5.6.43'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server (GPL)

Now when I create a Wordpress Deployment, it shows the below errors

kubi@kubem:~/wordpress2$ kubectl logs -f wordpress-67bbb57489-glm5r

Warning: mysqli::__construct(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in Standard input code on line 22

Warning: mysqli::__construct(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in Standard input code on line 22

MySQL Connection Error: (2002) php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution

Here are the Both Wordpress POD and Mysql POD describe :

Wordpress –

kubi@kubem:~/wordpress2$ kubectl describe  pod wordpress-67bbb57489-glm5r
Name:               wordpress-67bbb57489-glm5r
Namespace:          default
Priority:           0
PriorityClassName:  <none>
Node:               kubew1/192.168.56.111
Start Time:         Mon, 11 Mar 2019 13:26:56 +0100
Labels:             app=wordpress
                    pod-template-hash=67bbb57489
                    tier=frontend
Annotations:        <none>
Status:             Running
IP:                 10.244.1.48
Controlled By:      ReplicaSet/wordpress-67bbb57489
Containers:
  wordpress:
    Container ID:   docker://06e30ceddb0ebfdb9c71b597d538d2e58bc306d63837fa2d48447ec547ff23b5
    Image:          wordpress:latest
    Image ID:       docker-pullable://wordpress@sha256:08c71170cdd4427d155906f8eb0e715768c133f836780c97b0e3cc3e7c1288e2
    Port:           80/TCP
    Host Port:      0/TCP
    State:          Running
      Started:      Mon, 11 Mar 2019 13:34:56 +0100
    Last State:     Terminated
      Reason:       Error
      Exit Code:    1
      Started:      Mon, 11 Mar 2019 13:30:52 +0100
      Finished:     Mon, 11 Mar 2019 13:34:39 +0100
    Ready:          True
    Restart Count:  2
    Environment:
      WORDPRESS_DB_HOST:      mysql
      WORDPRESS_DB_PASSWORD:  <set to the key 'password.txt' in secret 'mysql-pass'>  Optional: false
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-fl5nc (ro)
      /var/www/html from wordpress-local-storage (rw)
Conditions:
  Type              Status
  Initialized       True 
  Ready             True 
  ContainersReady   True 
  PodScheduled      True 
Volumes:
  wordpress-local-storage:
    Type:    EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:  
  default-token-fl5nc:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-fl5nc
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type     Reason     Age                  From               Message
  ----     ------     ----                 ----               -------
  Normal   Scheduled  11m                  default-scheduler  Successfully assigned default/wordpress-67bbb57489-glm5r to kubew1
  Warning  BackOff    4m                   kubelet, kubew1    Back-off restarting failed container
  Normal   Pulling    3m48s (x3 over 11m)  kubelet, kubew1    pulling image "wordpress:latest"
  Normal   Pulled     3m45s (x3 over 11m)  kubelet, kubew1    Successfully pulled image "wordpress:latest"
  Normal   Created    3m44s (x3 over 11m)  kubelet, kubew1    Created container
  Normal   Started    3m44s (x3 over 11m)  kubelet, kubew1    Started container

Mysql –

Name:               mysql-65db44d76-ss9g7
Namespace:          default
Priority:           0
PriorityClassName:  <none>
Node:               kubew2/192.168.56.112
Start Time:         Mon, 11 Mar 2019 13:23:46 +0100
Labels:             app=wordpress
                    pod-template-hash=65db44d76
                    tier=mysql
Annotations:        <none>
Status:             Running
IP:                 10.244.2.41
Controlled By:      ReplicaSet/mysql-65db44d76
Containers:
  mysql:
    Container ID:   docker://4758a3a3fe6dbce6cfa185949c7b987019a2003d7f09924c182b36574290d9c7
    Image:          mysql:5.6
    Image ID:       docker-pullable://mysql@sha256:36cad5daaae69fbcc15dd33b9f25f35c41bbe7e06cb7df5e14d8b966fb26c1b4
    Port:           3306/TCP
    Host Port:      0/TCP
    State:          Running
      Started:      Mon, 11 Mar 2019 13:23:47 +0100
    Ready:          True
    Restart Count:  0
    Environment:
      MYSQL_ROOT_PASSWORD:  <set to the key 'password.txt' in secret 'mysql-pass'>  Optional: false
    Mounts:
      /var/lib/mysql from mysql-local-storage (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-fl5nc (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             True 
  ContainersReady   True 
  PodScheduled      True 
Volumes:
  mysql-local-storage:
    Type:    EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:  
  default-token-fl5nc:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-fl5nc
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type    Reason     Age   From               Message
  ----    ------     ----  ----               -------
  Normal  Scheduled  16m   default-scheduler  Successfully assigned default/mysql-65db44d76-ss9g7 to kubew2
  Normal  Pulled     16m   kubelet, kubew2    Container image "mysql:5.6" already present on machine
  Normal  Created    16m   kubelet, kubew2    Created container
  Normal  Started    16m   kubelet, kubew2    Started container

Here are the PV and PVC status – It shows that only mysql has bound but wordpress is not.

kubi@kubem:~/wordpress2$ kubectl get pvc,pv
NAME                                   STATUS    VOLUME           CAPACITY   ACCESS MODES   STORAGECLASS   AGE
persistentvolumeclaim/mysql-lv-claim   Bound     local-volume-1   8Gi        RWO                           27m
persistentvolumeclaim/wp-lv-claim      Pending                                                             24m

NAME                              CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS     CLAIM                    STORAGECLASS   REASON   AGE
persistentvolume/local-volume-1   8Gi        RWO            Retain           Bound      default/mysql-lv-claim                           27m
persistentvolume/local-volume-2   8Gi        RWO            Retain           Released   default/wp-lv-claim                              27m

Please suggest how to investigate the issue further, so that I can get the wordpress running on my cluster.

Cluster specification :
1 Master + 2 Slaves on Ubuntu VMs

Thanks

I think the main problem is connection to the DB, as the log says:

Warning: mysqli::__construct(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in Standard input code on line 22

Is it possible that you are not specifying it correctly?

Can you try to connect to the database from another pod? Does it work?

I see you posted you also have an issue with DNS resolution. That will explain this also :slight_smile:

Yes it is with DNS, I and when I am using busybox POD to debug the DNS.
I get below response. It is already posted on the forum. Here is the link

DNS Debug

Hey i m having same error any update ? Thanks !