How to setup Kubernetes cluster on AWS

DevOpsUPDATED ON November 19, 2021

4 tiles DevOps teams and consulting

Step-by-Step to Setting Up Kubernetes on AWS

In this edition of our AWS and Kubernetes consulting series, we’ll take you through a step-by-step to launching Kubernetes on Amazon Web Services.

Running an application in the cloud without the proper tools to manage it and improve its functionality can be tricky. That is why when deploying a customer’s application you want to have the means for fast deployment, features roll out, resource management, resilience and automation of certain operations. Kubernetes is an open-source platform that gives you a set of tools to do just that.

K&C - Creating Beautiful Technology Solutions For 20+ Years . Can We Be Your Competitive Edge?

Drop us a line to discuss your needs or next project

Today we will run Kubernetes multi-master cluster on AWS and deploy a simple application. We’ll use kops (Kubernetes Operations), which is a utility for managing Kubernetes clusters. In our opinion, currently kops is the best tool for deploying Kubernetes clusters in Amazon Web Services.

1. Creating a zone in Route53:

aws route53 create-hosted-zone name

2. Creating an S3 bucket to store the cluster configuration:

aws s3api create-bucket   --bucket kubernetes-cluster  --region eu-west-1

We include versioning:

aws s3api put-bucket-versioning --bucket kubernetes-cluster  --versioning-configuration Status=Enabled

3. Creating our new cluster

export KOPS_STATE_STORE=s3://kubernetes-cluster
kops create cluster 
--master-zones eu-west-1a,eu-west-1b,eu-west-1c 
--zones eu-west-1a,eu-west-1b,eu-west-1c 
--state s3://kubernetes-cluster 
--node-count 3 

name                          cluster name should be identical to zone name

master-zones            zones where masters will be launched

zones                          zones where the nodes will be located

state                            configuration storage bucket

node-count                a number of nodes in the cluster

yes                               applies changes

Checking availability of the cluster:

kops validate cluster

The output:

Using cluster from kubectl context:
Validating cluster
master-eu-west-1a	Master	m3.medium	1	1	eu-west-1a
master-eu-west-1b	Master	m3.medium	1	1	eu-west-1b
master-eu-west-1c	Master	m3.medium	1	1	eu-west-1c
nodes			Node	t2.medium	3	3	eu-west-1a,eu-west-1b,eu-west-1c
NAME						ROLE	READY	node	True	master	True	node	True	node	True	master	True	master	True
Your cluster is ready

Kops also creates settings for kubectl. We can also do:

kubectl get node

The output:   Ready     11d       v1.7.2   Ready     11d       v1.7.2    Ready     11d       v1.7.2

To edit nodes configuration, we do this:

kops edit ig nodes

Editing the file:

apiVersion: kops/v1alpha2
kind: InstanceGroup
  creationTimestamp: 2017-10-02T23:10:46Z
  name: nodes
  machineType: t2.medium -> t2.xlarge
  maxSize: 3 -> 4
  minSize: 3 -> 4
  role: Node
  - eu-west-1a
  - eu-west-1b
  - eu-west-1c

Saving the file and applying the configuration:

kops rolling-update cluster yes

Checking the state of the cluster:

kops validate cluster

The output:

nodes	Node  t2.xlarge	  4	4    eu-west-1a,eu-west-1b,eu-west-1c

For convenience, let’s deploy a dashboard:

kubectl create -f

Dashboard will be available at:!/pod?namespace=default


Now we will deploy a simple web application, with a setup for balancer with ssl and a domain name


To associate Kubernetes with Route53, we’ll need to deploy pod:

kubectl apply -f

In the IAM role, we’ll need to find the names of the nodes and add policy:

" Version": "2012-10-17",
    "Statement": [
            "Effect": "Allow",
            "Action": "route53:ListHostedZonesByName",
            "Resource": "*"
            "Effect": "Allow",
            "Action": "elasticloadbalancing:DescribeLoadBalancers",
            "Resource": "*"
            "Effect": "Allow",
            "Action": "route53:ChangeResourceRecordSets",
            "Resource": "*"

Writing a yaml file for Deployments:

apiVersion: apps/v1beta1
kind: Deployment
  name: project-ci
  replicas: 2
        projectenv: ci
        - name: project
           - name: DEPLOYMENT_ENV
              value: "ci"
            - name: FILEBEAT_ENABLE
              value: "yes"
            - containerPort: 80

Now creating a yaml file for Service:

kind: Service
apiVersion: v1
    domainName: "" "arn:aws:acm:us-west-1:659153740712:certificate/xxxxxxxx" "443" http
  name: projectci
    projectenv: ci
    dns: route53
    projectenv: ci
    - name: "https"
      protocol: TCP
      port: 443
  type: LoadBalancer

After deployment, we’ll see our application at


And in the AWS console we’ll see the newly created balancer:

That’s it! You’re good to go. You might also be interested in other articles in our Kubernetes series such as Our Guide for Hashicorp Consul/Vault with Kubernetes.

K&C – IT Services & Cloud Consulting Made In Germany

Munich-based K&C has over 20 years of experience as an IT Services consultant and outsourced development resource. We provide DevOps, Cloud services, Serverless architecture design and many other areas of expertise across contemporary development technology stacks and consultancy.

Our partners span some of Europe’s best known brands, exciting start-ups and well established SMEs – all of whom have learned to trust completely our combination of German management and nearshored tech talent to realise their outsourced IT needs.

We’d be delighted to hear about any project or problem we might be able to help you with! Just drop us a line or pick up the phone.

When does IT Outsourcing work?

(And when doesn’t it?)