Microk8s ingress example - taken from here (github) and updated to work with k8s as of 2024/03
- Install MicroK8s
Microk8s quickstart link
sudo snap install microk8s --classic
microk8s.start
- Install Ingress Dependent Resources
microk8s.kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/mandatory.yaml
- Enable Ingress Addon
microk8s.enable ingress
- Run a local Docker Registry
You can skip this step if you wanna host your image on a public/private repository.
docker run -p 5000:5000 registry
- Clone Example Repository And Build Docker Image
git clone https://github.com/chicagobuss/microk8s-ingress-example
cd microk8s-ingress-example
docker build . -t my-microk8s-app
docker tag my-microk8s-app localhost:5000/my-microk8s-app
docker push localhost:5000/my-microk8s-app
- Run Applications And Ingress
microk8s.kubectl apply -f bar-deployment.yml
microk8s.kubectl apply -f foo-deployment.yml
microk8s.kubectl apply -f ingress.yml
- Expose Deployments to Ingress
If you skip this step you'll get a 503 service unavailable
microk8s.kubectl expose deployment foo-app --type=LoadBalancer --port=8080
microk8s.kubectl expose deployment bar-app --type=LoadBalancer --port=8080
- Testing Endpoint Out
curl -kL https://127.0.0.1/bar
curl -kL https://127.0.0.1/foo