wordpress container works in docker but fails to load in kubernetes

5/26/2019

This docker command is working as expected.

docker run -p 8084:80 -e WORDPRESS_DB_HOST=mydb.cd8nudnovwjha.us-east-1.rds.amazonaws.com -e WORDPRESS_DB_NAME=wp -e WORDPRESS_DB_USER=root -e WORDPRESS_DB_PASSWORD=abcd -d wordpress

But how to use it in kubernetes environment?

/usr/local/bin/kubectl  --kubeconfig="k8s-1-14-2-do-0-blr1-1558866674146-kubeconfig.yaml" run mywordpress2 --image=wordpress  --port=80 --env="WORDPRESS_DB_HOST=mydb.cd8nudnovwjha.us-east-1.rds.amazonaws.com" --env="WORDPRESS_DB_USER=root" --env="WORDPRESS_DB_PASSWORD=abcd"  

I tried the above command but it does not start the wordpress like the docker command. I am using Amazon RDS if that matters.


Update:

I followed all the instructions found here...

https://kubernetes.io/docs/tutorials/stateful-application/mysql-wordpress-persistent-volume/

And I am still not able to install wordpress on the published wordpress IP.

# /usr/local/bin/kubectl --kubeconfig="testme2-kubeconfig.yaml" get services
NAME              TYPE           CLUSTER-IP       EXTERNAL-IP    PORT(S)        AGE
kubernetes        ClusterIP      10.245.0.1       <none>         443/TCP        13m
wordpress         LoadBalancer   10.245.216.246   139.59.51.65   80:30784/TCP   9m2s
wordpress-mysql   ClusterIP      None             <none>         3306/TCP       9m3s

Do I need to make some changes to yaml config file to suit digital ocean nodes? I am asking this because official digital ocean repo is working correctly as expected.

https://github.com/digitalocean/doks-example

-- shantanuo
digital-ocean
docker
kubernetes

0 Answers