Skip to content

Latest commit

 

History

History
85 lines (52 loc) · 1.05 KB

File metadata and controls

85 lines (52 loc) · 1.05 KB

1 - Create simple pod with nginx image

kubectl run pod1 --image=nginx -l=app=nginx

2 - Create service

kubectl expose pod pod1 --name=svc --port=80

3 - Install nginx controller

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.41.2/deploy/static/provider/baremetal/deploy.yaml

4 - Creating ingress

vi ingress1.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-example
  annotations:
     kubernetes.io/ingress.class: nginx
     nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
  - host: ingress.external
    http:
      paths:
      - pathType: Prefix
        path: "/"
        backend:
          service:
            name: svc
            port:
              number: 80
kubectl apply -f ingress1.yaml

5 - Verify ingress (DOUBLE CHECK THIS PART)

kubectl get svc -n ingress-nginx

ifconfig eth0

Add hosts

vi /etc/hosts
curl http://ingeress.external:30433