Google cloud platform 如何在现有GKE集群上启用Istio SDS
我有一个安装了Istio插件的现有GKE群集,例如:Google cloud platform 如何在现有GKE集群上启用Istio SDS,google-cloud-platform,google-kubernetes-engine,istio,Google Cloud Platform,Google Kubernetes Engine,Istio,我有一个安装了Istio插件的现有GKE群集,例如: gcloud beta container clusters create istio-demo \ --addons=Istio --istio-config=auth=MTLS_PERMISSIVE \ --cluster-version=[cluster-version] \ --machine-type=n1-standard-2 \ --num-nodes=4 我正在安装证书管理器,以便从Let's
gcloud beta container clusters create istio-demo \
--addons=Istio --istio-config=auth=MTLS_PERMISSIVE \
--cluster-version=[cluster-version] \
--machine-type=n1-standard-2 \
--num-nodes=4
我正在安装证书管理器
,以便从Let's Encrypt自动提供TLS证书。根据指南,Istio需要启用SDS,这可以在安装点完成:
helm install istio.io/istio \
--name istio \
--namespace istio-system \
--set gateways.istio-ingressgateway.sds.enabled=true
由于我已经通过GKE安装了Istio,如何在现有集群上启用SDS?或者,是否可以在创建群集时使用
gcloud
CLI启用SDS?每个设计的托管Istio将还原任何自定义配置并再次禁用SDS。所以,伊姆霍,这是一个无用的场景。您可以在此之后手动启用SDS,但请记住,配置将仅保持活动状态2-3分钟
目前,GKE不支持在从头创建集群时启用SDS。在GKE管理的Istio上,谷歌希望有能力发布,但他们还没有发布该版本的ETA
但是,如果您使用非托管(开源)Istio,SDS功能在中,我认为它应该在1.2版中可用,但这不是一个保证。根据Carlos的回答,我决定不在GKE上使用
Istio
插件,因为将Istio用作托管服务时,可用的定制非常有限
我创建了一个标准的GKE集群
gcloud beta container clusters create istio-demo \
--cluster-version=[cluster-version] \
--machine-type=n1-standard-2 \
--num-nodes=4
然后手动安装Istio
即使当前由GKE上的Istio创建的
默认入口网关
不支持SDS,您也可以手动添加自己的额外入口网关
您可以在istio系统
命名空间中获取默认istio入口网关
部署
和服务
的清单,并对其进行修改以添加SDS容器并更改名称,然后将其应用于集群。但这有点太乏味了,有一个更简单的方法:
首先下载istio的开源掌舵图(选择一个在GKE版本上与您的istio一起工作的版本,在我的例子中,我在GKE上的istio是1.1.3,我下载了开源istio 1.1.17,它可以工作):
然后仅为入口通道组件渲染头盔模板:
helm template istio/ --name istio \
--namespace istio-system \
-x charts/gateways/templates/deployment.yaml \
-x charts/gateways/templates/service.yaml \
--set gateways.istio-egressgateway.enabled=false \
--set gateways.istio-ingressgateway.sds.enabled=true > istio-ingressgateway.yaml
然后通过以下修改手动修改渲染的istio ingresgateway.yaml
文件:
元数据.name
更改为类似istio-ingresgateway-sds
metadata.lables.istio
更改为类似于ingressgateway sds
spec.template.metadata.labels
,类似于ingressgateway sds
spec.selector.istio
更改为相同的值,如ingressgateway sds
kubectl apply -f istio-ingressgateway.yaml
你好!您现在已经创建了自己的istio ingressgatway和SDS,您可以通过以下方式获得其负载平衡器IP:
kubectl -n istio-system get svc istio-ingressgateway-sds
要让您的网关
使用正确的启用sds的入口网关,您需要设置spec.selector.istio
以匹配您设置的入口网关。下面是使用kubernetes机密作为TLS证书的网关资源的示例:
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: gateway-test
spec:
selector:
istio: ingressgateway-sds
servers:
- hosts:
- '*.example.com'
port:
name: http
number: 80
protocol: HTTP
tls:
httpsRedirect: true
- hosts:
- '*.example.com'
port:
name: https
number: 443
protocol: HTTPS
tls:
credentialName: example-com-cert
mode: SIMPLE
privateKey: sds
serverCertificate: sds
谢谢卡洛斯。这正是我走的路线。我在没有Istio插件的情况下重新创建了我的GKE集群,然后在启用SDS的情况下手动安装了Istio。我将发布一个带有代码的单独答案。
curl -O https://storage.googleapis.com/istio-release/releases/1.1.17/charts/istio-1.1.17.tgz
# extract under current working directory
tar xzvf istio-1.1.17.tgz
helm template istio/ --name istio \
--namespace istio-system \
-x charts/gateways/templates/deployment.yaml \
-x charts/gateways/templates/service.yaml \
--set gateways.istio-egressgateway.enabled=false \
--set gateways.istio-ingressgateway.sds.enabled=true > istio-ingressgateway.yaml
kubectl apply -f istio-ingressgateway.yaml
kubectl -n istio-system get svc istio-ingressgateway-sds
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: gateway-test
spec:
selector:
istio: ingressgateway-sds
servers:
- hosts:
- '*.example.com'
port:
name: http
number: 80
protocol: HTTP
tls:
httpsRedirect: true
- hosts:
- '*.example.com'
port:
name: https
number: 443
protocol: HTTPS
tls:
credentialName: example-com-cert
mode: SIMPLE
privateKey: sds
serverCertificate: sds