详解
代码
概览
[root@m-1 ingress]# tree
.
├── deploy-svc.sh
├── deploy.yaml
├── example-ingress.yaml
├── ingress.tar
└── svc.yaml
0 directories, 5 files
部署ingress
sealos install --pkg-url ./ingress.tar
deploy-svc.sh
[root@m-1 ingress]# cat deploy-svc.sh
#!/bin/bash
sudo kubectl create deploy web --image=nginx:1.14-alpine -n dmgeo -o yaml > deploy.yaml
sudo kubectl expose deploy web --port=80 --target-port=80 --type=NodePort -n dmgeo -o yaml > svc.yaml
example-ingress.yaml
[root@m-1 ingress]# cat example-ingress.yaml
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: example-ingress
namespace: dmgeo
spec:
rules:
- host: example.ingressdemo.com
http:
paths:
- path: /
backend:
serviceName: web
servicePort: 80
查看ingress端口
[root@m-1 ingress]# sudo kubectl get -n heptio-contour service contour -o wide
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR
contour LoadBalancer 10.97.190.104 <pending> 80:18181/TCP,443:4408/TCP 35m app=contour
[root@m-1 ingress]#