公告

特别推出京东优惠挖掘小程序 [点击这里,扫码收藏] 专门收集京东今日特价爆品,商家漏洞等,拼手速,手慢无! 新增优惠: 1,美团外卖红包:扫码至少节省3元[点击收藏],全国可用,用完还能领。 2,车主加油打折服务:一键导航到加油站,选择油枪,支付时直减。 [点击查看] 3,电影票购买返利,覆盖所有主流院线。 [点击查看]

#1 2022-07-27 18:33:14

小天天
Moderator
注册时间: 2019-09-29
帖子: 886

k8s v1.24.3 二进制部署之后的ingress-nginx服务暴露

---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

离线

#2 2022-07-29 18:48:55

小天天
Moderator
注册时间: 2019-09-29
帖子: 886

Re: k8s v1.24.3 二进制部署之后的ingress-nginx服务暴露

去掉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)

离线

页脚

Powered by 华新企财帮

京ICP备19031397号-1