服务网格Istio-1.13.8版本部署
v1.13.8版本为定制化开发的,支持IPv4\6双栈的版本,和社区的v1.13.8版本不一样,请注意。
前提条件
需要Helm,版本为3.6+
底层环境依赖要求:
v1.21.5 Containerd v1.5.7 4.19.0
请注意v1.13.8对底层环境要求,必须满足对应的选型和版本要求,否则v1.13.8支持双栈会存在问题。
目前了解到,如果是新建的资源池(当前时间为2022-8-18日),v1.13.8版本对底层环境的要求是都满足的,但已有的资源池,需要确认并按需升级,如k8s版本升级,如果container runtime为docker,需要替换为containerd,如果操作系统内核版本版本低,需要升级内核版本(需要注意,如果内核版本是4.19.25的话,是低于4.19.0的,需要升级到4.19.0的)
部署准备
请先阅读部署准备,进行相应准备工作。
如果istio部署在公司的共享k8s集群中,由于istio-cni安装需要使用hostpath方式的volume,在共享k8s集群中是不允许的,需要找共享k8s集群维护人员将istio添加例外。
部署
解压manifests.tar.gz
tar zxvf manifests.tar.gz
创建istio-system
kubectl create namespace istio-system
部署istio-base
helm install istio-base manifests/charts/base -n istio-system
部署istiod
需要根据Istio的使用场景(单租户还是多租户),使用不同的安装方法(区别是设置了PILOT_SCOPE_GATEWAY_TO_NAMESPACE参数)
注意根据实际情况设置global.hub(镜像仓库地址),pilot.replicaCount和pilot.autoscaleMin(pod副本数,为保证高可用,请设置2+)
如果是跨AZ部署Istio的场景,请设置global.deployedInMultiZones=true
单租户场景
helm install istiod manifests/charts/istio-control/istio-discovery
–set global.imagePullPolicy=“IfNotPresent”
–set global.hub=“nexus.cmss.com:8086/cnp/istio”
–set global.tag=“1.13.8”
–set global.jwtPolicy=third-party-jwt
–set pilot.replicaCount=2
–set pilot.autoscaleMin=2
–set pilot.env.ISTIO_DUAL_STACK=true
–set pilot.env.PILOT_USE_ENDPOINT_SLICE=true
–set istio_cni.enabled=true
–set sidecarInjectorWebhook.rewriteAppHTTPProbe=false
–set global.deployedInMultiZones=false
-n istio-system
多租户场景
helm install istiod manifests/charts/istio-control/istio-discovery
–set global.imagePullPolicy=“IfNotPresent”
–set global.hub=“nexus.cmss.com:8086/cnp/istio”
–set global.tag=“1.13.8”
–set global.jwtPolicy=third-party-jwt
–set pilot.replicaCount=2
–set pilot.autoscaleMin=2
–set pilot.env.ISTIO_DUAL_STACK=true
–set pilot.env.PILOT_USE_ENDPOINT_SLICE=true
–set istio_cni.enabled=true
–set sidecarInjectorWebhook.rewriteAppHTTPProbe=false
–set pilot.env.PILOT_SCOPE_GATEWAY_TO_NAMESPACE=true
–set global.deployedInMultiZones=false
-n istio-system
部署istio-cni
注意根据实际情况设置global.hub(镜像仓库地址)
helm install istio-cni manifests/charts/istio-cni
–set global.hub=“nexus.cmss.com:8086/cnp/istio”
–set global.tag=“1.13.8”
–set global.jwtPolicy=third-party-jwt
–set cni.enabled=true
–set cni.components.cni.enabled=true
–set istio_cni.enabled=true
–set global.imagePullPolicy=“IfNotPresent”
–set values.cni.logLevel=info
–set values.cni.excludeNamespaces={“istio-system,kube-system”}
-n istio-system
部署istio-ingress-gateway(按需)
根据是否需要istio-ingress-gateway选择是否部署。
如果需要部署,请根据场景(单租户或多租户)进行安装,主要区别是部署的namespace不同。
注意根据实际情况设置global.hub(镜像仓库地址),gateways.istio-ingressgateway.replicaCount和autoscaleMin(pod副本数,为保证高可用,请设置2+)。
如果是跨AZ部署Istio的场景,请设置global.deployedInMultiZones=true。
更多的设置项,可以查看manifests/charts/gateways/istio-ingress/values.yaml,并进行设置。
单租户场景
将ingress gateway部署在istio-ingress namespace下
kubectl create namespace istio-ingress
helm install istio-ingress manifests/charts/gateways/istio-ingress
–set global.hub=“nexus.cmss.com:8086/cnp/istio”
–set global.tag=“1.13.8”
–set global.imagePullPolicy=“IfNotPresent”
–set global.jwtPolicy=third-party-jwt
–set gateways.istio-ingressgateway.replicaCount=2
–set gateways.istio-ingressgateway.autoscaleMin=2
–set global.deployedInMultiZones=false
-n istio-ingress
多租户场景
将ingress gateway部署在产品自己的namespace下(如foo下)
注意根据实际情况设置namespace
helm install istio-ingress manifests/charts/gateways/istio-ingress
–set global.hub=“nexus.cmss.com:8086/cnp/istio”
–set global.tag=“1.13.8”
–set global.imagePullPolicy=“IfNotPresent”
–set global.jwtPolicy=third-party-jwt
–set gateways.istio-ingressgateway.replicaCount=2
–set gateways.istio-ingressgateway.autoscaleMin=2
–set global.deployedInMultiZones=false
-n foo
自定义服务类型及端口
如果需要自定义ingress gateway的服务类型及端口,比如设置服务类型为NodePort(默认为LoadBalancer方式),多个开放端口,可以参考以下参数部署
注意根据实际情况设置namespace、服务类型及开放端口
helm install istio-ingress manifests/charts/gateways/istio-ingress
–set global.hub=“nexus.cmss.com:8086/cnp/istio”
–set global.tag=“1.13.8”
…
–set gateways.istio-ingressgateway.type=NodePort
–set gateways.istio-ingressgateway.ports[0].name=http-web0
–set gateways.istio-ingressgateway.ports[0].port=31100
–set gateways.istio-ingressgateway.ports[0].targetPort=31100
–set gateways.istio-ingressgateway.ports[0].nodePort=31100
–set gateways.istio-ingressgateway.ports[0].protocol=TCP
–set gateways.istio-ingressgateway.ports[1].name=http-web1
–set gateways.istio-ingressgateway.ports[1].port=31101
–set gateways.istio-ingressgateway.ports[1].targetPort=31101
–set gateways.istio-ingressgateway.ports[0].nodePort=31101
–set gateways.istio-ingressgateway.ports[1].protocol=TCP
–set gateways.istio-ingressgateway.ports[2].name=http-web2
–set gateways.istio-ingressgateway.ports[2].port=31102
–set gateways.istio-ingressgateway.ports[2].targetPort=31102
–set gateways.istio-ingressgateway.ports[0].nodePort=31102
–set gateways.istio-ingressgateway.ports[2].protocol=TCP
–set gateways.istio-ingressgateway.ports[3].name=http-web3
–set gateways.istio-ingressgateway.ports[3].port=31103
–set gateways.istio-ingressgateway.ports[3].targetPort=31103
–set gateways.istio-ingressgateway.ports[0].nodePort=31103
–set gateways.istio-ingressgateway.ports[3].protocol=TCP
…
-n foo
使用公司BC-SLB暴露Gateway服务
使用公司BC-SLB暴露Gateway服务,需要为gateway service添加annotations,具体咨询BC-SLB同事,添加annotations示例如下:
注意根据实际情况设置namespace、ecloud.10086.cn/slb-svc.UniqueID等annotations值、添加需要的annotations
helm install istio-ingress manifests/charts/gateways/istio-ingress
–set global.hub=“nexus.cmss.com:8086/cnp/istio”
–set global.tag=“1.13.8”
…
–set gateways.istio-ingressgateway.serviceAnnotations.“ecloud.10086.cn/slb-svc.UniqueID”=“paas-istio-foo”
–set gateways.istio-ingressgateway.serviceAnnotations.“ecloud.10086.cn/slb-svc.VIPPersistence”=“true”
…
-n foo
卸载
注意请根据istio-ingress的实际部署namespace,修改对应的卸载命令
helm uninstall istio-ingress -n istio-ingress
helm uninstall istiod -n istio-system
helm uninstall istio-base -n istio-system
helm uninstall istio-cni -n istio-system
kubectl get crd -oname | grep --color=never ‘istio.io’ | xargs kubectl delete
浙公网安备 33010602011771号