Create kind cluster

While our EKS cluster is being created we can create a kind cluster locally. Before we create one lets make sure our network rules are set up

This is going to manually create some iptables rules to route traffic to your Cloud9 instance. If you reboot the VM you will have to run these commands again as they persistent.

echo 'net.ipv4.conf.all.route_localnet = 1' | sudo tee /etc/sysctl.conf
sudo sysctl -p /etc/sysctl.conf
sudo iptables -t nat -A PREROUTING -p tcp -d --dport 80 -j DNAT --to-destination
sudo iptables -t nat -A OUTPUT -d -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 51679

Create a config file for the kind cluster

cat > kind.yaml <<EOF
kind: Cluster
- role: control-plane
  image: kindest/node:v1.19.11@sha256:07db187ae84b4b7de440a73886f008cf903fcf5764ba8106a9fd5243d6f32729
  - containerPort: 30000
    hostPort: 30000
  - containerPort: 30001
    hostPort: 30001

Create the local kind cluster

kind create cluster --config kind.yaml

Set the default context to the EKS cluster.

kubectl config use-context "${INSTANCE_ID}@${CLUSTER}.${AWS_REGION}"