Setting up WordPress on Amazon Web Services (AWS) using the Kubernetes package manager, Helm, is a straightforward process. This guide will walk you through the steps to launch a highly available, scalable WordPress installation in minutes.
Table of Contents
Create EKS Cluster
Create an Amazon Elastic Kubernetes Service (EKS) cluster. This can be done via the “eksctl” command line tool.
curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp
sudo mv /tmp/eksctl /usr/local/bin
eksctl create cluster
Install Helm
Helm is a package manager for Kubernetes, and it is used to deploy and manage applications on a Kubernetes cluster. You can install Helm by following the official Helm installation guide.
sudo yum install openssl -y
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 > get_helm.sh
chmod 700 get_helm.sh
./get_helm.sh
Set Up EBS CSI addon for EKS
First, create an IAM OIDC provider for your cluster.
oidc_id=$(aws eks describe-cluster --name my-cluster --query "cluster.identity.oidc.issuer" --output text | cut -d '/' -f 5)
aws iam list-open-id-connect-providers | grep $oidc_id | cut -d "/" -f4
eksctl utils associate-iam-oidc-provider --cluster my-cluster --approve
Add IAM Role using eksctl
eksctl create iamserviceaccount \
--name ebs-csi-controller-sa \
--namespace kube-system \
--cluster my-cluster \
--attach-policy-arn arn:aws:iam::aws:policy/service-role/AmazonEBSCSIDriverPolicy \
--approve \
--role-only \
--role-name AmazonEKS_EBS_CSI_DriverRole
Then add EBS CSI to EKS by running the following command
eksctl create addon --name aws-ebs-csi-driver --cluster my-cluster --service-account-role-arn arn:aws:iam::111122223333:role/AmazonEKS_EBS_CSI_DriverRole --force
Install WordPress using Helm
Install the WordPress chart: To install the WordPress chart, run the following command:
helm repo add bitnami https://charts.bitnami.com/bitnami
Once the chart is added then install WordPress using the below command.
helm install my-release --set wordpressUsername=admin --set wordpressPassword=defaultpass bitnami/wordpress
This will install the latest version of the WordPress chart from the official Bitnami repository. A default user is created with the username “admin” and the password is set to “defaultpass”.
Access the WordPress site
After the installation is complete, you can access the WordPress site using the URL provided by the output of the install command. Alternatively, you can go to EC2->Load Balancer and grab the Load balancer URL from there.
Conclusion
With these steps, you have successfully deployed a highly available and scalable WordPress installation on AWS using Helm. This setup can be easily managed, scaled, and maintained, making it an ideal choice for hosting a WordPress site.
Pingback: How To Setup WordPress In AWS Eks Using Helm – Redoy's Blog