Skip to content

Latest commit

 

History

History
58 lines (39 loc) · 1.97 KB

getting-started.md

File metadata and controls

58 lines (39 loc) · 1.97 KB

Getting Started

How do I use this?

  1. Refer or select one of the examples
  2. Customize the module by referring to their variables.tf
  3. Access the master instance with GoSSM or via AWS console, or by Port Tunneling :6443
  4. It is also recommended to use a backend to persist state information. Read here

Existing VPC

To run this module, simply

  1. Select the VPC that you wish to deploy k3s in
  2. Carve out a subnet of the VPC to deploy this in. Ensure the cidr range is unused by other subnets
  3. Use cloudposse/dynamic-subnets to create new additional subnets. This is a cleaner approach

Refer example.

New VPC

Refer example.

Access

Connect to instances with GoSSM

  1. Install gossm
  2. Enter shell with gossm start
  3. Optionally for convenience, run source /usr/bin/aliases, refer here
  4. Check that kubernetes is running with kubectl get all --all-namespaces

Access kubernetes locally

  1. Install SSM plugin on your local machine
  2. Copy the content of /etc/rancher/k3s/k3s.yaml to your local path, eg:
gossm cmd -e "cat /etc/rancher/k3s/k3s.yaml"

# after seeing a list of instances,
# hit "space" to select master instance, before hitting "enter"
  1. Find the instance ID with gossm start, look for /i-*/
  2. Start a tunnel with:
aws ssm start-session \
    --target MY_EC2_INSTANCE_ID \
    --document-name AWS-StartPortForwardingSession \
    --parameters '{"portNumber":["6443"], "localPortNumber":["6443"]}'
  1. Activate the kubeconfig with export KUBECONFIG="$(pwd)/k3s.yaml"
  2. Access the cluster, eg: kubectl get all -A

asciicast