Creating an Elastic Kubernetes Service (EKS) cluster

Contents

Instructions on setting up a managed Kubernetes cluster on Amazon Web Services (AWS)

Prerequisites

You will need the following:

An Amazon account

Sign up or log in to AWS where you will create the k8s cluster. TODO Verify

aws cli

Command-line tool to manage resources in AWS. Get it Amazon.

eksctl

Amazons version of Kubectl, eksctl, allows you to run commands against Kubernetes clusters. Download it from Github

IAM user

With these permissions/roles at least: https://eksctl.io/usage/minimum-iam-policies/

Create an EKS cluster

Create EKS cluster

You may create EKS clusters from both Console and Command line. For simplcity, we use command line.

The XP operator currently does not support "AWS Fargate" (due to limitations on open file handlers). Use managed instances instead.
Instance type

A recommended instance type is m5.xlarge (or bigger).

Kubernetes version

Should be >= 1.27.9

Follow the steps below to get a basic EKS cluster up and running:

  1. Create an access key, and configure the aws CLI as described here: https://docs.aws.amazon.com/eks/latest/userguide/install-awscli.html

  2. Make a cluster configuration Yaml file

    cluster-config.yaml
    apiVersion: eksctl.io/v1alpha5
    kind: ClusterConfig
    
    metadata:
      name: enonic
      region: eu-north-1
    
    managedNodeGroups:
      - name: eks-mng
        instanceType: m5.xlarge
        desiredCapacity: 1
    
    iam:
      withOIDC: true
      serviceAccounts:
      - metadata:
          name: aws-load-balancer-controller
          namespace: kube-system
        wellKnownPolicies:
          awsLoadBalancerController: true
    
    addons:
      - name: aws-ebs-csi-driver
        wellKnownPolicies: # Adds an IAM service account
          ebsCSIController: true
    
    cloudWatch:
     clusterLogging:
       enableTypes: ["*"]
       logRetentionInDays: 30
    Replace region with your preferred one
  3. and create the cluster with the following command:

    eksctl create cluster -f cluster-config.yaml
    AWS may take quite some time to provision the cluster

    Once finished, you should see something like this in your output log:

    2024-10-30 13:47:58 [✔]  EKS cluster "enonic" in "eu-north-1" region is ready
    NOTE

    For production use, you will likely also need to configure an AWS load balancer,

Connect to the cluster

  1. Create a kubeconfig file with the following command

    aws eks update-kubeconfig --region REGION --name CLUSTER_NAME
  2. Verify you can now connect to the cluster with kubectl

    kubectl get namespaces

    This should display a list of namespaces in the newly created k8s cluster. The "Age" column in the output shows how long has it been since the namespaces are created.

    NAME              STATUS   AGE
    default           Active   8h
    kube-node-lease   Active   8h
    kube-public       Active   8h
    kube-system       Active   8h

Storage classes

Next step is to list available storage classes with this command:

kubectl get storageclasses

This should display the list of storage classes provisioned by GKE cluster.

NAME   PROVISIONER             RECLAIMPOLICY   VOLUMEBINDINGMODE      ALLOWVOLUMEEXPANSION   AGE
gp2    kubernetes.io/aws-ebs   Delete          WaitForFirstConsumer   false                  9h

EFS

To run XP in clustered mode, a ReadWriteMany storage class (NFS type filesystem) is required.

You may run your own NFS server, or take advantage of Amazon’s managed service for shared filesystems called Elastic File System (EFS).

To provision an EFS storage for your cluster, follow Amazons own documentation:

Once this is configured properly, you may specify efs as your shared storage class when [installing the XP operator].


Contents

Contents

AI-powered search

Juke AI