<p>I'm beginner to K8s so please bear with me.</p>
<p>I've rollout a wordpress with a mysql using Kubernetes. The rollout has completed and is running on my machine using <code>minikube</code>.</p>
<p>However, the thing is wordpress is not showing up on my browser</p>
<p>These are my pods</p>
<blockquote>
<p>mysql291020-68d989895b-vxbwg        1/1     Running            0          18h</p>
</blockquote>
<blockquote>
<p>wp291020-7dccd94bd5-dfqqn           1/1     Running            0          19h</p>
</blockquote>
<p>These are my services</p>
<blockquote>
<p>mysql291020-68d989895b-vxbwg        1/1     Running            0          18h</p>
</blockquote>
<blockquote>
<p>wp291020-7dccd94bd5-dfqqn           1/1     Running            0          19h</p>
</blockquote>
<p>After some thoughts, I thought it maybe related to how I setup my service for wordpress (see code below).</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: wp291020
  labels:
    app: wp291020
spec:
  ports:
    - port: 80
  selector:
    app: wp291020
    tier: frontend
  type: LoadBalancer
</code></pre>
<p>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.</p>
<blockquote>
<p>deployment for wordpress</p>
</blockquote>
<pre><code>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: {}
</code></pre>
<blockquote>
<p>service for mysql</p>
</blockquote>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: mysql291020
  labels:
    app: mysql291020
spec:
  ports:
    - port: 3306
  selector:
    app: mysql291020
    tier: mysql
  clusterIP: None
</code></pre>
<blockquote>
<p>deployment for mysql</p>
</blockquote>
<pre><code>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: {}
</code></pre>
<p>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.</p>
<p>I can provide my docker compose yaml if asked.</p>
<p>Thank you.</p>
<p>PS: I'm adding my docker compose file, in case</p>
<pre><code>version: '3.3'

services:
   wordpress:
     depends_on:
       - db
     image: wordpress:latest
     volumes:
       - wordpress_files:/var/www/html
     ports:
       - &quot;80:80&quot;
     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:
</code></pre>

<p>To access the frontend from your web browser, you can port-forward the service to your local machine.</p>
<pre><code>kubectl port-forward svc/wp291020 80:80
</code></pre>
<p>If you are using a cloud system with an external IP, you would need to verify that IP address is getting attached to your service, as shown <a href="https://minikube.sigs.k8s.io/docs/handbook/accessing/" rel="nofollow noreferrer">here</a></p>
