页次: 1
---k8s---
指定ingress对外的服务节点:我选择给3台master打label
kubectl label nodes k8s-master-6.gjt.com Ingress=nginx
kubectl label nodes k8s-master-7.gjt.com Ingress=nginx
kubectl label nodes k8s-master-8.gjt.com Ingress=nginx
暴漏ingress control端口80,443
deployment---》spec 添加
hostNetwork: true
nodeSelector:
Ingress: nginx
deployment---》spec---》template 添加
name: controller
ports:
- containerPort: 80
hostPort: 80
name: http
protocol: TCP
- containerPort: 443
hostPort: 443
name: https
protocol: TCP
- containerPort: 8443
hostPort: 8443
name: webhook
protocol: TCP
---k8s 工程部署---
###deployment###
kubectl create deployment multimediaapi --replicas=3 --image=reg.gjt.com/gjtoon/nginx:v1.0 -n gjtoon
###svc###
kubectl expose deployment multimediaapi --port=80 --target-port=8081 -n gjtoon --selector="app=ultimediaapi" \
--dry-run=client -oyaml
###ingress###
kubectl create ingress multimediaapi --rule="multimediaapi.gtj.com/*=ultimediaapi:80" --class=nginx -n bjtoon \
--dry-run=client -oyaml
多个path路径
kubectl create ingress unifieduser \
--annotation nginx.ingress.kubernetes.io/rewrite-target=/ \
--annotation nginx.ingress.kubernetes.io/ssl-redirect="false" \
--rule="org.git.com/unifieduser*=unifieduser:80" \
--rule="org.git.com/orgauth*=orgauth:80" \
--rule="org.git.com/console*=console:80" \
--rule="org.git.com/oapi*=oapi:80" \
--rule="org.git.com/portal*=portal:80" \
--rule="org.git.com/grouporgan*=grouporgan:80" \
--rule="org.git.com/bizcustomer*=bizcustomer:80" \
--rule="org.git.com/bizcontact*=bizcontact:80" \
--rule="org.git.com/operation*=operation:80" \
--rule="org.git.com/appconfig*=appconfig:80" \
--rule="org.git.com/colleaguesmanage*=colleaguesmanage:80" \
--rule="org.git.com/generalorgan*=generalorgan:80" \
--class=nginx -n gitoon\
--dry-run=client \
-o yaml
离线
去掉path路径中某一个目录
kubectl create ingress org-systoon-com-multipath \
--annotation nginx.ingress.kubernetes.io/rewrite-target=/\$2 \ ###,注意转义
--annotation nginx.ingress.kubernetes.io/ssl-redirect="false" \
--rule="org.systoon.com/colleaguesmanage(/|$)(.*)=colleaguesmanage:80" \
--class=nginx -n gjtoon \
--dry-run=client \
-o yaml
最近编辑记录 小天天 (2022-08-01 21:09:19)
离线
页次: 1