F5与Openshift集成怎么实现灰度发布

发布时间:2021-11-23 21:31:04 作者:柒染
来源:亿速云 阅读:157

这期内容当中小编将会给大家带来有关F5与Openshift集成怎么实现灰度发布,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。

一、为什么要使用灰度发布
F5与Openshift集成怎么实现灰度发布

二、F5与Openshift集成实现灰度发布

F5与Openshift集成配置与部署(实现灰度发布)

准备工作(详细见上篇:Openshift-F5集成(南北流量走F5))

设置VS中的cccl-whitelist为1

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: f5-bigip-ctlr-01
spec:
  replicas: 1
  template:
    metadata:
      name: k8s-bigip-ctlr
      labels:
        app: k8s-bigip-ctlr
    spec:      # Name of the Service Account bound to a Cluster Role with the required
      # permissions
      serviceAccountName: bigip-ctlr
      containers:
        - name: k8s-bigip-ctlr          # replace the version as needed
          image: "f5networks/k8s-bigip-ctlr:1.5.1"
          env:
            - name: BIGIP_USERNAME
              valueFrom:
                secretKeyRef:                  # Replace with the name of the Secret containing your login
                  # credentials
                  name: bigip-login
                  key: username
            - name: BIGIP_PASSWORD
              valueFrom:
                secretKeyRef:                  # Replace with the name of the Secret containing your login
                  # credentials
                  name: bigip-login
                  key: password          command: ["/app/bin/k8s-bigip-ctlr"]
          args: [            # See the k8s-bigip-ctlr documentation for information about
            # all config options
            # http://clouddocs.f5.com/products/connectors/k8s-bigip-ctlr/latest
            "--bigip-username=$(BIGIP_USERNAME)",            "--bigip-password=$(BIGIP_PASSWORD)",            "--bigip-url=192.168.200.82",            "--bigip-partition=OpenShift",            "--pool-member-type=cluster",            "--openshift-sdn-name=/Common/openshift_vxlan",            '--manage-routes=true'
            '--route-http-vserver=testroute'
            '--route-https-vserver=testroute_https'
            ]
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: f5-bigip-ctlr-02
spec:
  replicas: 1
  template:
    metadata:
      name: k8s-bigip-ctlr
      labels:
        app: k8s-bigip-ctlr
    spec:      # Name of the Service Account bound to a Cluster Role with the required
      # permissions
      serviceAccountName: bigip-ctlr
      containers:
        - name: k8s-bigip-ctlr          # replace the version as needed
          image: "f5networks/k8s-bigip-ctlr:1.5.1"
          env:
            - name: BIGIP_USERNAME
              valueFrom:
                secretKeyRef:                  # Replace with the name of the Secret containing your login
                  # credentials
                  name: bigip-login
                  key: username
            - name: BIGIP_PASSWORD
              valueFrom:
                secretKeyRef:                  # Replace with the name of the Secret containing your login
                  # credentials
                  name: bigip-login
                  key: password          command: ["/app/bin/k8s-bigip-ctlr"]
          args: [            # See the k8s-bigip-ctlr documentation for information about
            # all config options
            # http://clouddocs.f5.com/products/connectors/k8s-bigip-ctlr/latest
            "--bigip-username=$(BIGIP_USERNAME)",            "--bigip-password=$(BIGIP_PASSWORD)",            "--bigip-url=192.168.200.83",            "--bigip-partition=OpenShift",            "--pool-member-type=cluster",            "--openshift-sdn-name=/Common/openshift_vxlan",            '--manage-routes=true'
            '--route-http-vserver=testroute'
            '--route-https-vserver=testroute_https'
            ]

给vs手动绑定Policies

  • Openshift F5控制器创建好后,在F5上会自动创建两条Policies, 分别为:openshift_insecure_routes、openshift_secure_routes。

  • openshift_insecure_routes为HTTP应用服务

  • openshift_secure_routes为HTTPS应用服务。

     

    F5与Openshift集成怎么实现灰度发布

    绑定Policies与iRule

创建应用(Project名为testapp,Service名为f5-nginx-v1与f5-nginx-v2)

oc new-project testapp
oc new-app harbor.example.com/public/nginx:1.14 --name=f5-nginx-v1 --allow-missing-images
oc expose dc/f5-test-v1 --port=8080oc expose svc/f5-test-v1 test1.apps.openshift.com
oc new-app harbor.example.com/public/nginx:1.14 --name=f5-nginx-v2 --allow-missing-images
oc expose dc/f5-test-v2 --port=8080

创建iRule,并绑定到VS F5


说明:请求域名test1.apps.openshift.com时,如果客户端IP为192.168.100.23,则访问testapp项目下的f5-nginx-v2服务,否则访问testapp项目下的f5-nginx-v1服务
注意:iRule规则需要在Common的Partition下创建

when HTTP_REQUEST { if { [HTTP::host] equals "test1.apps.openshift.com" }{  log local0.info [HTTP::host]   if {[IP::addr [IP::client_addr] equals 192.168.100.23/32 ]} {  log local0.info "enter 2 pool before"
  log local0.info [HTTP::host]
  pool /f5-openShift/openshift_testapp_f5-nginx-v2  log local0.info "enter 2 pool later"
  } else {  log local0.info "enter 3"
   pool /f5-openShift/openshift_testapp_f5-nginx-v1
  }
 }
}

测试访问服务

本地(192.168.100.23)与另一台非192.168.100.23的机器上绑定hosts

VS的IP地址 test1.apps.openshift.com

再访问test1.apps.openshift.com,查看页面显示,访问不同的Service。

上述就是小编为大家分享的F5与Openshift集成怎么实现灰度发布了,如果刚好有类似的疑惑,不妨参照上述分析进行理解。如果想知道更多相关知识,欢迎关注亿速云行业资讯频道。

推荐阅读:
  1. 基于cookie在nginx实现业务灰度发布
  2. 什么是灰度发布,以及灰度发布A/B测试

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

f5 openshift

上一篇:OAM Kubernetes 实现核心原理是什么

下一篇:c语言怎么实现含递归清场版扫雷游戏

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》