This is a project to setup the required infrastructure to run Kubernetes The Hard Way in the AWS cloud.
This will provision EC2 instance types to match the tutorial specs. This will provision t4 Graviton instances which are ARM-based architectures.
Name | CPU | RAM | Storage | Instance |
---|---|---|---|---|
jumpbox | 1 | 512MB | 10GB | t4g.nano |
server | 2 | 2GB | 20GB | t4g.small |
node-0 | 2 | 2GB | 20GB | t4g.small |
node-1 | 2 | 2GB | 20GB | t4g.small |
This project will deploy resources to your AWS account.
- You will first need to create a key-pair so you can later connect to your EC2 instances. This also means you can use this key to execute commands over ssh into the k8s compute instances.
aws ec2 create-key-pair \
--key-name k8s-thw-key-pair \
--key-type rsa \
--key-format pem \
--query "KeyMaterial" \
--output text > k8s-thw-key-pair.pem
- Remember to change the key-pair file permissions
chmod 400 k8s-thw-key-pair.pem
- First create an
.env
file (See env.template) and set theCDK_DEFAULT_ACCOUNT
to your AWS ACCOUNT value andCDK_DEFAULT_REGION
to your region.
Note: this currently only supports
us-east-1
andus-west-2
regions.
- Bootstrap your account
npm cdk boostrap
- Deploy your resources
npx cdk deploy
Done! You should now be able to SSH
into your jumpbox
server.
aws cloudformation delete-stack --stack-name K8sTheHardWayStack
This uses an EC2 key pair to connect to your instances. In this repository, we will use the same key-pair to connect to all your instances.
npm run build
compile typescript to jsnpm run fix
format your codenpm run watch
watch for changes and compilenpm run test
perform the jest unit testsnpx cdk deploy
deploy this stack to your default AWS account/regionnpx cdk diff
compare deployed stack with current statenpx cdk synth
emits the synthesized CloudFormation template
You can use
--require-approval never
on your deploy to skip any prompts