kubectl run pod1 --image=nginx -l=app=nginx
kubectl expose pod pod1 --name=svc --port=80
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.41.2/deploy/static/provider/baremetal/deploy.yaml
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
kubectl get svc -n ingress-nginx
ifconfig eth0
Add hosts
vi /etc/hosts
curl http://ingeress.external:30433