chadxz / kubernetes-the-hard-way-aws

Learning stuff.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

kubernetes the hard way (on AWS)

Following kubernetes-the-hard-way but on AWS instead of GCP. Learning Terraform in the process.

Provisioning Steps (so far)

  • install Docker for Mac, awscli, cfssl, awscli ssm plugin, terraform, ansible
  • setup awscli profile
  • setup SSH ProxyCommand for ssm
  • cd remote-state && tfswitch && terraform init && terraform apply
  • tfswitch && terraform init && terraform apply
  • cd configuration
  • ./deploy-certificates.sh
  • ./deploy-configuration.sh
  • ...more to come

Notes from each section

tools and environment

network and compute

I also performed the following:

  • setup a versioning-enabled s3 bucket for terraform state
  • setup a DynamoDB table with LockID (string) partition key for terraform state
  • Created an IAM role to assign AmazonSSMManagedInstanceCore policy to instances to use Session Manager instead of SSH
    • SSM also requires instance to be able to access its AWS public zone APIs, so we had to setup an internet gateway and assign instances public ipv4 ip addresses. This could have also been accomplished using a NAT gateway without assigning public ipv4 addresses, but those cost $.
  • installed session manager plugin for aws-cli to support the aws ssm start-session command
  • One main point here is I didn't expose SSH ports, and am instead using AWS SSM for access. An SSH key must still be provisioned to the server though to use SSH/SCP tooling, but the access control is done using IAM instead of interface security groups or subnet network access control lists.
  • SSH/SCP via SSM requires you to set up a ProxyCommand in your SSH config. See https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-getting-started-enable-ssh-connections.html

Provisioning a CA and Generating TLS Certificates

Generating Kubernetes Configuration Files for Authentication

Generating the Data Encryption Config and Key

Bootstrapping the etcd Cluster

About

Learning stuff.


Languages

Language:HCL 56.6%Language:Shell 43.4%