We recently helped a client migrate ten of his wordpress sites from shared hosting to Ingress Amazon EKS cluster. One of the requirement was to setup a single EKS cluster with one database for all sites. During migration, we hit a couple of issues around Ingress resources and configuring it to use SSL certificates from Amazon Certificate Manager (ACM). In Part 1 of this blog series, we will cover the Ingress setup for EKS. In Part 2, we will talk about ACM and discuss SSL redirect from http to https.

Pre-requisite: In order to support multiple domains, you will need to install the AWS ALB Ingress Controller as documented here -> LINK

The AWS ALB Ingress controller is a controller that triggers the creation of an ALB and the necessary supporting AWS resources whenever a Kubernetes user declares an Ingress resource on the cluster. The Ingress resource uses the ALB to route HTTP[s] traffic to different endpoints within the cluster. The AWS ALB Ingress controller works on any Kubernetes cluster including Amazon Elastic Container Service for Kubernetes (EKS).

Ingress Amazon EKS Cluster | Resource Setup

Step-1: Create ingress.yaml using the following code as reference:

apiVersion: extensions/v1beta1

kind: Ingress

metadata:

  annotations:

    alb.ingress.kubernetes.io/listen-ports: ‘[{“HTTP”: 80}]’

    alb.ingress.kubernetes.io/scheme: internet-facing

    kubernetes.io/ingress.class: alb

  labels:

    app: coderise-io

  name: ingress

spec:

  rules:

  – host: api.domain1.io

    http:

      paths:

      – backend:

          serviceName: domain1-wordpress

          servicePort: 80

        path: /*

  – host: domain2.com

    http:

      paths:

      – backend:

          serviceName: domain2-wordpress

          servicePort: 80

        path: /*

Step-2: Apply the ingress resource by running the following command:

kubectl apply -f ingress.yaml

Step-3 Validate it by running this command:

$kubectl get ing

NAME      HOSTS                                          ADDRESS                                                                PORTS   AGE

ingress   api.domain1.io,domain2.com   7e7d2kda-default-ingress-e8c7-17572d31078.us-west-2.elb.amazonaws.com   80      23h

Step-4: Update Route-53 by creating a new A record set pointing to the ALB i.e. 7e7d2kda-default-ingress-e8c7-17572d31078.us-west-2.elb.amazonaws.com

Step-5: Test it by browsing to http://api.domain1.io/ or http://domain2.com/

—–

Full details on installing WordPress on EKS are detailed here

One Response

Leave a Reply

Your email address will not be published. Required fields are marked *