I tried configuring ingress cluster. I ran the following commands
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/mandatory.yaml kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/provider/baremetal/service-nodeport.yaml
After that default-http-backend and nginx-ingress-controller were running:
ingress-nginx default-http-backend-846b65fb5f-6kwvp 1/1 Running 0 23h 192.168.2.28 node1
ingress-nginx nginx-ingress-controller-d658896cd-6m76j 1/1 Running 0 6m 192.168.2.31 node1
I tried testing ingress and I deployed the following service:
apiVersion: apps/v1
kind: Deployment
metadata:
name: echoserver-deploy
spec:
replicas: 2
selector:
matchLabels:
app: echo
template:
metadata:
labels:
app: echo
spec:
containers:
- name: my-echo
image: gcr.io/google_containers/echoserver:1.8
---
apiVersion: v1
kind: Service
metadata:
name: echoserver-svc
spec:
selector:
app: echo
ports:
- protocol: TCP
port: 8080
targetPort: 8080
And the following ingress:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: happy-ingress
annotations:
INGRESS.kubernetes.io/rewrite-target: /
spec:
rules:
- host: happy.k8s.io
http:
paths:
- path: /echoserver
backend:
serviceName: echoserver-svc
servicePort: 8080
When I ran the command 'kubectl get ing' I received:
NAME HOSTS ADDRESS PORTS AGE
happy-ingress happy.k8s.io 80 14m