当前位置: 首页 > news >正文

我的网站要换新域名如何做怎么进行推广

我的网站要换新域名如何做,怎么进行推广,360安全浏览器,一个网站页面设计多少钱创建Istio Gateway 背景如何创建Istio Gateway规则配置方式rewrite重写路径直接去除match,默认都转发到一个服务路由规则多种配置方式实践(即开头的完整版) 涉及的命令补充注意事项 背景 为什么需要使用到Istio Gateway?充当k8s服…

创建Istio Gateway

  • 背景
  • 如何创建Istio Gateway
  • 规则配置方式
    • rewrite重写路径
    • 直接去除match,默认都转发到一个服务
    • 路由规则多种配置方式实践(即开头的完整版)
  • 涉及的命令补充
  • 注意事项

背景

为什么需要使用到Istio Gateway?充当k8s服务访问的外部流量访问入口,类似nginx一样的作用

如何创建Istio Gateway

1、检查是否已开启istio-ingressgateway服务

servicemesh:
enabled: true # 将“false”更改为“true”。
istio: https://istio.io/latest/docs/setup/additional-setup/customize-installation/components:ingressGateways:- name: istio-ingressgateway enabled: true # 将“false”更改为“true”

2、创建yaml配置文件

touch nginx-gateway.yaml

3、输入配置内容

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:name: mygateway
spec:selector:istio: ingressgateway # use istio default ingress gatewayservers:- port:number: 80name: httpprotocol: HTTPhosts:- forecast.example.com
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:name: mygateway
spec:hosts:- forecast.example.comgateways:- mygatewayhttp:- match:- uri:prefix: "/nginx/"  # 新路径, prefix 前缀匹配, 满足 /p1 的都要被重写rewrite:uri: "/"    # 老路径route:- destination:host: nginx-79zn9d  # 对应service中的名称,具有负责均衡- match:- uri:prefix: "/tomcat/"  # 新路径, prefix 前缀匹配, 满足 /p1 的都要被重写rewrite:uri: "/"    # 老路径route:- destination:host: tomcat-5tl05n # 对应service中的名称,具有负责均衡- match:- uri:prefix: "/myapp1/"  rewrite:uri: "/"route:- destination:host: my-app1       # 对应service中的名称,具有负责均衡- match:- uri:prefix: "/myapp2/"  rewrite:uri: "/"route:- destination:host: my-app2        # 对应service中的名称,具有负责均衡

4、执行创建,会同时创建gateway和VirtualService

kubectl apply -f nginx-gateway.yaml --namespace=project-demo

5、确定Istio入口ip和port (负载均衡器)

kubectl get svc istio-ingressgateway -n istio-system

6、最后客户端访问前,进行客户端host配置

ip【服务器 istio-ingressgateway的ip】 forecast.example.com

7、更新gateway,先导出->再修改->最后更新

kubectl get gw mygateway  -o yaml -n project-demo > /home/k8s/gateway-update.yaml
kubectl apply -f gateway-update.yaml

8、更新virtualservice

kubectl get virtualservice mygateway  -o yaml -n project-demo > /home/k8s/gatewaySvc-update.yaml
kubectl apply -f gatewaySvc-update.yaml

规则配置方式

rewrite重写路径

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:name: mygateway
spec:selector:istio: ingressgateway # use istio default ingress gatewayservers:- port:number: 80name: httpprotocol: HTTPhosts:- forecast.example.com
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:name: mygateway
spec:hosts:- forecast.example.comgateways:- mygatewayhttp:- match:- uri:prefix: "/nginx/"  # 新路径, prefix 前缀匹配, 满足 /p1 的都要被重写rewrite:uri: "/"    # 老路径route:- destination:host: nginx-79zn9d

直接去除match,默认都转发到一个服务

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:name: mygateway
spec:selector:istio: ingressgateway # use istio default ingress gatewayservers:- port:number: 80name: httpprotocol: HTTPhosts:- forecast.example.com
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:name: mygateway
spec:hosts:- forecast.example.comgateways:- mygatewayhttp:- route:- destination:host: nginx-79zn9d

路由规则多种配置方式实践(即开头的完整版)

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:name: mygateway
spec:selector:istio: ingressgateway # use istio default ingress gatewayservers:- port:number: 80name: httpprotocol: HTTPhosts:- forecast.example.com
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:name: mygateway
spec:hosts:- forecast.example.comgateways:- mygatewayhttp:- match:- uri:prefix: "/nginx/"  # 新路径, prefix 前缀匹配, 满足 /p1 的都要被重写rewrite:uri: "/"    # 老路径route:- destination:host: nginx-79zn9d  # 对应service中的名称,具有负责均衡- match:- uri:prefix: "/tomcat/"  # 新路径, prefix 前缀匹配, 满足 /p1 的都要被重写rewrite:uri: "/"    # 老路径route:- destination:host: tomcat-5tl05n # 对应service中的名称,具有负责均衡- match:- uri:prefix: "/myapp1/"  rewrite:uri: "/"route:- destination:host: my-app1       # 对应service中的名称,具有负责均衡- match:- uri:prefix: "/myapp2/"  rewrite:uri: "/"route:- destination:host: my-app2        # 对应service中的名称,具有负责均衡

涉及的命令补充

#networking.istio.io版本
kubectl api-versions | grep networking.istio.io#确定Istio入口ip和port (负载均衡器)
kubectl get svc istio-ingressgateway -n istio-system#检查有没有在相同的 IP和端口上定义 Kubernetes Ingress 资源
kubectl get ingress --all-namespaces#检查有没有在相同的端口上定义其它 Istio Ingress Gateway
kubectl get gateway --all-namespaces# 查看网关
kubectl get gw -A# 删除网关
-- kubectl delete gw my-gateway -n project-demo# 查看路由规则
kubectl get virtualservices my-VirtualService -n project-demo -o yaml# 删除virtualservice
kubectl delete virtualservice nginx-79zn9d -n project-demo# 更新gateway
kubectl get gw mygateway  -o yaml -n project-demo > /home/k8s/gateway-update.yaml
kubectl apply -f gateway-update.yaml# 更新virtualservice
kubectl get virtualservice mygateway  -o yaml -n project-demo > /home/k8s/gatewaySvc-update.yaml
kubectl apply -f gatewaySvc-update.yaml

注意事项

  • VirtualService中的metadata.name需要跟Gateway中的metadata.name一致
http://www.ds6.com.cn/news/63166.html

相关文章:

  • 百度推广一个点击多少钱浙江搜索引擎优化
  • 怀化公司做网站企业网站seo方案
  • 网站建设的新发展百度问一问客服人工在线咨询
  • 创新网站设计seo网站建设优化
  • 如何取外贸网站域名百度上的广告多少钱一个月
  • 湖北省建设银行网站长沙网站seo外包
  • 广告联盟哪个好做灰色词seo靠谱
  • 西充建设局网站济南计算机培训机构哪个最好
  • 要对网页中各个元素优化大师免费下载
  • 网页背景做的比较好的网站湖人最新消息
  • 温州公司网站开发电商培训心得体会
  • 建设工程网上质检备案网站网络seo关键词优化技术
  • 滕州本地网站建设沈阳专业网站seo推广
  • 卧龙区网站制作百度关键词优化大
  • 谷歌网站江东怎样优化seo
  • 佛山微网站建设多少钱网站制作的基本流程
  • 情侣做记录网站源码晋江友情链接是什么意思
  • 百度小程序制作网站买卖网交易平台
  • 企业logo设计思路杭州seo关键字优化
  • html5的网站设计seo网站平台
  • 网站建设所需要软件关键词排名零芯互联排名
  • 扁平网站欣赏太原网站排名推广
  • wordpress显示加载耗时淘宝seo是指什么
  • 搭建网站赚钱吗简述seo对各类网站的作用
  • 金数据可以做网站吗百度手机助手app免费下载
  • 北京网站设计公司yy成都柚米科技15百度seo排名优化是什么
  • 郴州网站建设较好的公司seo网络推广
  • 坑梓做网站教你如何建立网站
  • 十大最坑装修公司排名seo网站关键词快速排名
  • 小清新网站设计地推接单平台网