<p>I have an EC2 instance that I use for personal work &amp; projects with very small amounts of traffic (portfolio, etc).</p>
<p>I thought it'd be really cool (although obviously overkill) to set up a dev cluster running my various projects using Minikube and to connect a domain name to this instance.</p>
<h2>Setup</h2>
<p>I have an Ingress controller that points to my service, with an IP address that is different than the host machine. I think it's somehow the IP address of the VM, but only accessible from the host machine.</p>
<p>I'd really like to use Ingress because I have a number of projects running with different domain names in use. Seems like the simple &amp; correct solution based on my limited knowledge.</p>
<h2>Problem</h2>
<p>Not knowing much about k8s/networking, I don't know how to get external traffic visiting the elastic IP assigned to my instance to be directed to the Ingress controller</p>
<h2>What I've tried</h2>
<p>I was thinking that, since this is really only going to be used for dev purposes, that I could try using <code>kubect port-forward ...</code> somehow to point to my Ingress controller. But <a href="https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#port-forward" rel="nofollow noreferrer">this</a> <code>port-forward</code> reference from the official website says nothing about Ingress controllers.</p>
<h2>Question</h2>
<p>What is the most correct way to get external traffic into my cluster via an Ingress controller?</p>

wheresmycookie
<p>Assuming this is not for real production workload I would suggest below approach</p>
<ol>
<li><p>Instead of using minikube use <a href="https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/" rel="nofollow noreferrer">kubeadm</a> to install a single node kubernetes cluster on the EC2 instance.</p>
</li>
<li><p>Make sure to remove the master node taint so that workload pods can be scheduled on the master node meaning the same EC2 instance will host control plane pods as well as workload pods. Command for that is</p>
<p><code>kubectl taint nodes nodename node-role.kubernetes.io/master:NoSchedule-</code></p>
</li>
<li><p>Install nginx ingress controller and use <code>hostNetwork: true</code> in the deployment yaml. So nginx will listen to the EC2 instance's network on port <code>80</code> and <code>443</code>. Here is the doc on <a href="https://kubernetes.github.io/ingress-nginx/deploy/baremetal/#via-the-host-network" rel="nofollow noreferrer">this</a>.</p>
</li>
<li><p>Create ingress resource and you can access any service via EC2 instances public IP address.</p>
</li>
<li><p>When you have budget for more EC2 instance you can add those as worker nodes to the cluster using <code>kubeadm join</code>.</p>
</li>
</ol>
<p>Note: You can use free <code>t2.micro</code> which is tier EC2 instance as worker nodes.</p>
