DEV Community

Cover image for How to Deploy WordPress to Amazon EKS using Helm
Dickson Victor for AWS Community Builders

Posted on

How to Deploy WordPress to Amazon EKS using Helm

In this article, you will learn how to deploy a production ready wordpress site to Amazon Elastic Kubernetes Service(EKS) with just a few easy steps. This is made possible using a package manager known as helm.

What is Helm?

Helm is a Kubernetes deployment tool for automating creation, packaging, configuration, and deployment of applications and services to Kubernetes clusters. It is an open source package manager that automates the deployment of software for Kubernetes in a simple, consistent way. Helm deploys packaged applications to Kubernetes and structures them into charts. The charts contain all pre-configured application resources along with all the versions into one easily manageable package.

What is a Helm Chart?

Helm charts are Helm packages consisting of YAML files and templates which convert into Kubernetes manifest files. These charts are reusable by anyone for any environment, which reduces complexity and duplicates.

For this demo, I made use of the helm chart for wordpress developed and maintained by bitnami.


Ensure that you have the following utilities installed and configured on your machine.

1. Provision the EKS cluster

Run the following code on your terminal after placing the value for your preferred region and existing keypair name

cat <<EOF>>demo-eks-cluster.yaml
kind: ClusterConfig

  name: demo-eks-cluster
  region: your-region
  version: "1.21"

  - name: dev-ng-1
    instanceType: t3.large
    minSize: 1
    maxSize: 1
    desiredCapacity: 1
    volumeSize: 20
    volumeEncrypted: true
    volumeType: gp3
      allow: true
      publicKeyName: your-keypair-name
      Env: Dev
        - arn:aws:iam::aws:policy/AmazonEKSWorkerNodePolicy
        - arn:aws:iam::aws:policy/AmazonEKS_CNI_Policy
        - arn:aws:iam::aws:policy/ElasticLoadBalancingFullAccess
        - arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly
        - arn:aws:iam::aws:policy/CloudWatchAgentServerPolicy
        autoScaler: true
Enter fullscreen mode Exit fullscreen mode

To confirm that the nodes have been provisioned, run:

kubectl get nodes
Enter fullscreen mode Exit fullscreen mode

2. Deploy Wordpress to EKS

First, add the helm repo to your environment.

helm repo add my-repo
Enter fullscreen mode Exit fullscreen mode

Then, install the helm chart for wordpress. For this use case, I did overwrite the default wordpressPassword value in values.yaml using the command:

helm install my-release my-repo/wordpress --set wordpressPassword=password
Enter fullscreen mode Exit fullscreen mode

After successful deployment, check the pods and see if status reads "Running"

kubectl get pods
Enter fullscreen mode Exit fullscreen mode

3. Accessing your wordpress site

To access your WordPress site from outside the cluster follow the steps below:

  1. Get the WordPress URL by running these commands: NOTE: It may take a few minutes for the LoadBalancer IP to be available.
export SERVICE_IP=$(kubectl get svc --namespace default wp-demo-wordpress --include "{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}")
echo "WordPress URL: http://$SERVICE_IP/"
echo "WordPress Admin URL: http://$SERVICE_IP/admin"
Enter fullscreen mode Exit fullscreen mode
  1. Open a browser and access WordPress using the obtained URL.
  2. Login with the following credentials below to see your blog:

username: user
password: password
Adding a /admin to the url gives the following:

adding /admin
Login with the credentials and you should hit your wordpress admin page


4. Cleaning up

To clean up the resources created using the eksctl utility, run the following:

eksctl delete cluster demo-eks-cluster
Enter fullscreen mode Exit fullscreen mode

Congratulations, your have successfully deployed a production-grade wordpress website to amazon EKS. Feel free to connect with me on linkedin if you have any questions.

Top comments (1)

avinashdalvi_ profile image
Avinash Dalvi

Would like to give try on EKS WordPress hosting. Thanks for this article.