= Create Kubernetes cluster using CloudFormation and Terraform
:toc:
:icons:
:linkcss:
:imagesdir: ../../resources/images

This chapter explains how to create a Kubernetes cluster using CloudFormation and Terraform.

== CloudFormation

https://aws.amazon.com/cloudformation/[AWS CloudFormation] gives developers and systems administrators an easy way to create and manage a collection of related AWS resources, provisioning and updating them in an orderly and predictable fashion.

A CloudFormation template is available in the link:cloudformation[] directory.

In the example below, create a Kubernetes cluster with cloudformation using the aws cli. Note that a valid EC2 KeyName registered to your account must be supplied to execute successfully.

	cd quickdeploy
	aws cloudformation create-stack \
		--stack-name k8s \
		--template-body file://cloudformation/k8s-create-no-alb.yaml \
		--capabilities CAPABILITY_IAM \
		--parameters \
			ParameterKey=KeyName,ParameterValue=demo-key-2 \
			ParameterKey=MasterInstanceType,ParameterValue=c4.xlarge \
			ParameterKey=NetworkProvider,ParameterValue=calico \
			ParameterKey=NodeInstanceType,ParameterValue=c4.large \
			ParameterKey=Nodes,ParameterValue=3

The following is an explanation of the input parameters:

	KeyName: This must be a valid EC2 KeyPair for ssh access. # Required
	MasterInstanceType: EC2 instance type of master. # Defaulted to c4.xlarge
	NetworkProvider: Container networking provider. # Defaulted to none
	NodeInstanceType: EC2 instance type of nodes. # Defaulted to c4.large
	Nodes: Number of k8s nodes. # Defaulted to 3

NOTE: https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/[kubeadm] is used to create the cluster. Currently, it allows to create a single master, with a single etcd database running on it. This means your cluster is not highly available.

== Terraform

The template and instructions need to be added: https://github.com/arun-gupta/kubernetes-aws-workshop/issues/135


You are now ready to continue on with the workshop!

:frame: none
:grid: none
:valign: top

[align="center", cols="1", grid="none", frame="none"]
|=====
|image:button-continue-operations.png[link=../../04-path-security-and-networking/401-configmaps-and-secrets]
|link:../../operations-path.adoc[Go to Operations Index]
|=====
