I have deployed the WeaveSocks sample app on a manually installed kubeadm that is hosted on a VM (Ubuntu 20.04) on Azure (educational purpose).
I want now the app to be able on the VM domain name : \<name>.switzerlandnorth.cloudapp.azure.com
Here is what I have : <br> Deploy the app
kubectl create namespace sock-shop
kubectl apply -n sock-shop -f "https://github.com/microservices-demo/microservices-demo/blob/master/deploy/kubernetes/complete-demo.yaml?raw=true"
kubectl -n sock-shop get svc front-end
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
front-end NodePort 10.98.85.243 <none> 80:30001/TCP 43m
Ingress Controller
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.1.1/deploy/static/provider/cloud/deploy.yaml
Ingress <br>
ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: sock-shop
annotations:
kubernetes.io/ingress.class: nginx
spec:
rules:
- host: "<name>.switzerlandnorth.cloudapp.azure.com"
http:
paths:
- pathType: Prefix
path: "/"
backend:
service:
name: sock-shop
port:
number: 80
kubectl apply -f ingress.yaml
Some commands that may be useful
kubectl get svc --all-namespaces
NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
ingress-nginx ingress-nginx-controller LoadBalancer 10.100.216.61 <pending> 80:30460/TCP,443:31272/TCP 53m
ingress-nginx ingress-nginx-controller-admission ClusterIP 10.97.67.150 <none> 443/TCP 53m
kubectl describe service -n ingress-nginx ingress-nginx-controller
Name: ingress-nginx-controller
Namespace: ingress-nginx
Labels: app.kubernetes.io/component=controller
app.kubernetes.io/instance=ingress-nginx
app.kubernetes.io/managed-by=Helm
app.kubernetes.io/name=ingress-nginx
app.kubernetes.io/version=1.1.1
helm.sh/chart=ingress-nginx-4.0.15
Annotations: <none>
Selector: app.kubernetes.io/component=controller,app.kubernetes.io/instance=ingress-nginx,app.kubernetes.io/name=ingress-nginx
Type: LoadBalancer
IP Family Policy: SingleStack
IP Families: IPv4
IP: 10.100.216.61
IPs: 10.100.216.61
Port: http 80/TCP
TargetPort: http/TCP
NodePort: http 30460/TCP
Endpoints: 192.168.205.198:80
Port: https 443/TCP
TargetPort: https/TCP
NodePort: https 31272/TCP
Endpoints: 192.168.205.198:443
Session Affinity: None
External Traffic Policy: Local
HealthCheck NodePort: 30942
Events: <none>
With this I'm unable to go to http://\<name>.switzerlandnorth.cloudapp.azure.com and see my app.
What am I doing wrong ?
EDIT I've done a telnet \<name\>.switzerlandnorth.cloudapp.azure.com 80
and it can't connect to port 80. So it seems that the Ingress is not listening at all on the port 80 of the host.
Maybe you can modify configuration about your hosts (/etc/hosts) file to make sure your computer can resolve this domain name. Use NAT mode in your VM config, and find VM's ip to add the entry to hosts.