You need to create an Ingress resource named whisper in the sound-zone namespace.
This Ingress should route traffic to a Service called soundserver-svc,
and handle requests coming to http://mydemo.local/whisper.
Make sure it forwards traffic to port 9090 of the Service.
To test if everything is working, run the following command.
It should return 200 if the setup is correct:
curl -o /dev/null -s -w "%{http_code}\n" http://mydemo.local/whisper
Step 1: Create Namespace
kubectl create ns sound-zone
Step 2: Install NGINX Ingress Controller
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.10.1/deploy/static/provider/cloud/deploy.yaml
kubectl get pods -n ingress-nginx -l app.kubernetes.io/component=controller
Expose it via NodePort (as we are using Killercoda):
kubectl patch svc ingress-nginx-controller -n ingress-nginx \
-p '{"spec": {"type": "NodePort"}}'
kubectl get svc ingress-nginx-controller -n ingress-nginx
Step 3: Create a Dummy Deployment + Service
kubectl create deploy soundserver --image=ealen/echo-server -n sound-zone
kubectl expose deploy soundserver --port=9090 --target-port=80 \
--name=soundserver-svc -n sound-zone
echo "<k get nodes -o wide > mydemo.local" | sudo tee -a /etc/hosts
curl -o /dev/null -s -w "%{http_code}\n" -H "Host: mydemo.local" http://nodeip:nodeport/whisper
Comments
Post a Comment