- AWS account
- AWS IAM user - Note this user will need some IAM permissions including roles, policies, OpenID
% aws --version
aws-cli/2.11.5 Python/3.11.2 Darwin/22.3.0 exe/x86_64 prompt/off
% aws sts get-caller-identity
{
"UserId": "YYA4ZRSAMPLE6IDAGV2YP",
"Account": "378929636692",
"Arn": "arn:aws:iam::378929636692:user/dockerbisson"
}
- Install brew: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- Install helm: 'brew install helm'
- Install jq: 'brew install jq'
- Create account
- Create an org
- Terraform variables with AWS credentials
From the top level of the repo
brew install terraform
terraform init
terraform plan
time terraform apply -auto-approve
Get kubectl
config (more details):
aws eks --region us-west-2 update-kubeconfig --name demo-eks
The region
and name
values match those in the main.tf
file.
Install the helm chart
cd helm
helm install --create-namespace -n hello-telepresence-for-docker app ./hello-telepresence-for-docker --debug
kubectl get all -n hello-telepresence-for-docker
open "http://$(kubectl get service -n hello-telepresence-for-docker -o json | jq -r '.items[].status.loadBalancer.ingress[].hostname')"
- Install the mod header extension for chrome
- Open Docker Desktop
- Install telepresence extension
- cd to the hello-app directory
- Update the Docker file - change the ENV MESSAGE to your message and save
- Type 'docker build -t hello-app .'
IMPORTANT - the GUI and CLI options are separate. You can do both, but you need to make sure the intercept is down before switching between them
- Open Docker Desktop
- Go to the Telepresence extension
- Select "Get Started" - the "Select Cluster for Telepresence Connection" dialog will appear
- The kubeconfig context should show the aws cluster
- Select "Install telepresence on this cluster" only if this is the first connection since building the cluster
- Select connect
- Click "start intercept" on the telepresence extension if you are not already on it
- Select the
hello-telepresence-for-docker
namespace - The
hello-telepresence-for-docker-app
service should be listed - Click "Intercept"
- A dialog appears for the intercept
- Make sure the target docker image is
hello-app:latest
- Target port number is
8080
- Leave the other settings
- Click "Create Intercept"
telepresence intercept --docker hello-telepresence-for-docker-app --namespace hello-telepresence-for-docker --port 8080:80 --docker-run -- -it --rm hello-app:latest
- Go to the containers tab
- Show there is a
tp-hello-telepresence-for-docker-app
container running - Explain that the Telepresence extension runs this container when the intercept starts based on the image you specify
Option 1: HTTP headers
- Copy the request header string shown in the current running intercepts (or on the terminal page)
- Put the
x-telepresence-intercept-id
in the name field in mod header - Put the rest (minus the colon after id) into the value field and make sure the green check is there
- Refresh the hello world page to see your new message
- Turn off the header and show the page goes back to hello world
Option 2: Preview URL
- Click the preview URL link (or copy from the terminal page) and show the updated page
- Refresh the original page to show it still has hello world
- Click stop intercept
- (optional) show the local container has stopped as well
telepresence leave
- cd to the
hello-app
directory - Update the Dockerfile - change the
ENV MESSAGE
to your message and save docker build -t hello-app .
helm delete -n hello-telepresence-for-docker $(helm ls --namespace hello-telepresence-for-docker --short)
kubectl get all -n hello-telepresence-for-docker
kubectl config use-context docker-desktop
From the top-level of the repo
terraform destroy -auto-approve
- Manually delete any load balancers associated with the cluster in the web console
- Manually delete the VPC associated with the cluster in the web console
terraform destroy -auto-approve
again
If needed...
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
- Originally created as a fork of https://github.com/hashicorp/learn-terraform-provision-eks-cluster, based on a Terraform EKS tutorial: https://developer.hashicorp.com/terraform/tutorials/kubernetes/eks
- the "hello-app" is derived from https://github.com/paulbouwer/hello-kubernetes