Wordpress and mysql pod rollout correct but wordpress not showing up on my browser

Cluster information:

Kubernetes version: v1.19.2
Cloud being used: bare-metal (minikube)
Installation method:
Host OS: Linux POP OS
CNI and version: N/A
CRI and version: N/A

I’m beginner to K8s so please bear with me.

I’ve rollout a wordpress with a mysql using Kubernetes. The rollout has completed and is running on my machine using minikube.

However, the thing is wordpress is not showing up on my browser

These are my pods

mysql291020-68d989895b-vxbwg 1/1 Running 0 18h

wp291020-7dccd94bd5-dfqqn 1/1 Running 0 19h

These are my services

mysql291020-68d989895b-vxbwg 1/1 Running 0 18h

wp291020-7dccd94bd5-dfqqn 1/1 Running 0 19h

After some thoughts, I thought it maybe related to how I setup my service for wordpress (see code below).

apiVersion: v1
kind: Service
metadata:
  name: wp291020
  labels:
    app: wp291020
spec:
  ports:
    - port: 80
  selector:
    app: wp291020
    tier: frontend
  type: LoadBalancer

Not sure if it is the right place to look at. I’m adding below my deployement for the wordpress, and also the service for mysql and the deployment for mysql, in case it is needed.

deployment for wordpress

apiVersion: apps/v1
kind: Deployment
metadata:
  name: wp291020
spec:
  selector:
    matchLabels:
      app: wp291020
  replicas: 1
  template:
    metadata:
      labels:
        app: wp291020
    spec:
      containers:
      - name: wp-deployment
        image: andykwo/test123:wp_291020
        ports:
        - containerPort: 80
        volumeMounts:
        - name: wordpress-persistent-storage
          mountPath: /var/www/html    
      volumes:
      - name: wordpress-persistent-storage
        emptyDir: {}

service for mysql

apiVersion: v1
kind: Service
metadata:
  name: mysql291020
  labels:
    app: mysql291020
spec:
  ports:
    - port: 3306
  selector:
    app: mysql291020
    tier: mysql
  clusterIP: None

deployment for mysql

apiVersion: apps/v1
kind: Deployment
metadata:
  name: mysql291020
spec:
  selector:
    matchLabels:
      app: mysql291020
  replicas: 1
  template:
    metadata:
      labels:
        app: mysql291020
    spec:
      containers:
      - env:
        - name: MYSQL_DATABASE
          value: wordpress
        - name: MYSQL_PASSWORD
          value: my_wordpress_db_password
        - name: MYSQL_ROOT_PASSWORD
          value: my_wordpress_db_password
        - name: MYSQL_USER
          value: wordpress        
        name: db
        image: andykwo/test123:wp_291020
        ports:
        - containerPort: 3306
        volumeMounts:
        - name: db-data
          mountPath: /var/lib/mysql    
      volumes:
      - name: db-data
        emptyDir: {}

Just to mention that the docker containers are functionning also correctly when running only on the containers but I do have access to the wordpress through my browser.

I can provide my docker compose yaml if asked.

Thank you,
Andy

PS: I’m adding my docker compose file, in case

version: '3.3'

services:
   wordpress:
     depends_on:
       - db
     image: wordpress:latest
     volumes:
       - wordpress_files:/var/www/html
     ports:
       - "80:80"
     restart: always
     environment:
       WORDPRESS_DB_HOST: db:3306
       WORDPRESS_DB_USER: wordpress
       WORDPRESS_DB_PASSWORD: my_wordpress_db_password

   db:
     image: mysql:5.7
     volumes:
       - db_data:/var/lib/mysql
     restart: always
     environment:
       MYSQL_ROOT_PASSWORD: my_db_root_password
       MYSQL_DATABASE: wordpress
       MYSQL_USER: wordpress
       MYSQL_PASSWORD: my_wordpress_db_password
volumes:
    wordpress_files:
    db_data:

What is the status of the service? and is it showing an IP you can reach? Your loadbalancer may be in a pending state. Typically on a bare-metal install you need to do node port or using something like metallb as the load balancer for the svc.

My guess is that’s where the issue is. Your service may be in a pending state.

1 Like