安装独立 Operator [实验]

The following information describes an experimental feature, which is intendedfor evaluation purposes only.

该指南将会指引您使用独立的 Istio operator 来安装 Istio。唯一的依赖就是一个 Kubernetes 集群和 kubectl 命令行工具。

如果要安装生产环境的 Istio,我们还是建议您参考使用 istioctl 安装

前提条件

  1. $ kubectl apply -f https://preliminary.istio.io/operator.yaml

This command runs the operator by creating the following resources in the istio-operator namespace:

  • The operator custom resource definition
  • The operator controller deployment
  • A service to access operator metrics
  • Necessary Istio operator RBAC rules

安装

运行以下命令用 operator 安装 Istio demo 配置文件

  1. $ kubectl apply -f - <<EOF
  2. apiVersion: install.istio.io/v1alpha2
  3. kind: IstioControlPlane
  4. metadata:
  5. namespace: istio-operator
  6. name: example-istiocontrolplane
  7. spec:
  8. profile: demo
  9. EOF

控制器会检测 IstioControlPlane 资源,然后按照指定的(demo)配置安装 Istio 组件。

您可以使用以下命令来确认 Istio 控制面板服务是否部署:

  1. $ kubectl get svc -n istio-system
  2. NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
  3. grafana ClusterIP 172.21.211.123 <none> 3000/TCP 2m
  4. istio-citadel ClusterIP 172.21.177.222 <none> 8060/TCP,15014/TCP 2m
  5. istio-egressgateway ClusterIP 172.21.113.24 <none> 80/TCP,443/TCP,15443/TCP 2m
  6. istio-galley ClusterIP 172.21.132.247 <none> 443/TCP,15014/TCP,9901/TCP 2m
  7. istio-ingressgateway LoadBalancer 172.21.144.254 52.116.22.242 15020:31831/TCP,80:31380/TCP,443:31390/TCP,31400:31400/TCP,15029:30318/TCP,15030:32645/TCP,15031:31933/TCP,15032:31188/TCP,15443:30838/TCP 2m
  8. istio-pilot ClusterIP 172.21.105.205 <none> 15010/TCP,15011/TCP,8080/TCP,15014/TCP 2m
  9. istio-policy ClusterIP 172.21.14.236 <none> 9091/TCP,15004/TCP,15014/TCP 2m
  10. istio-sidecar-injector ClusterIP 172.21.155.47 <none> 443/TCP,15014/TCP 2m
  11. istio-telemetry ClusterIP 172.21.196.79 <none> 9091/TCP,15004/TCP,15014/TCP,42422/TCP 2m
  12. jaeger-agent ClusterIP None <none> 5775/UDP,6831/UDP,6832/UDP 2m
  13. jaeger-collector ClusterIP 172.21.135.51 <none> 14267/TCP,14268/TCP 2m
  14. jaeger-query ClusterIP 172.21.26.187 <none> 16686/TCP 2m
  15. kiali ClusterIP 172.21.155.201 <none> 20001/TCP 2m
  16. prometheus ClusterIP 172.21.63.159 <none> 9090/TCP 2m
  17. tracing ClusterIP 172.21.2.245 <none> 80/TCP 2m
  18. zipkin ClusterIP 172.21.182.245 <none> 9411/TCP 2m
  1. $ kubectl get pods -n istio-system
  2. NAME READY STATUS RESTARTS AGE
  3. grafana-f8467cc6-rbjlg 1/1 Running 0 1m
  4. istio-citadel-78df5b548f-g5cpw 1/1 Running 0 1m
  5. istio-egressgateway-78569df5c4-zwtb5 1/1 Running 0 1m
  6. istio-galley-74d5f764fc-q7nrk 1/1 Running 0 1m
  7. istio-ingressgateway-7ddcfd665c-dmtqz 1/1 Running 0 1m
  8. istio-pilot-f479bbf5c-qwr28 1/1 Running 0 1m
  9. istio-policy-6fccc5c868-xhblv 1/1 Running 2 1m
  10. istio-sidecar-injector-78499d85b8-x44m6 1/1 Running 0 1m
  11. istio-telemetry-78b96c6cb6-ldm9q 1/1 Running 2 1m
  12. istio-tracing-69b5f778b7-s2zvw 1/1 Running 0 1m
  13. kiali-99f7467dc-6rvwp 1/1 Running 0 1m
  14. prometheus-67cdb66cbb-9w2hm 1/1 Running 0 1m

更新

现在,控制器已经在运行了,您可以通过编辑或替换 IstioControlPlane 资源来改变 Istio 的配置。控制器将会检测该变化,并对应的更新 Istio 的安装。

例如,您可以运行以下命令将安装切换为 default 配置:

  1. $ kubectl apply -f - <<EOF
  2. apiVersion: install.istio.io/v1alpha2
  3. kind: IstioControlPlane
  4. metadata:
  5. namespace: istio-operator
  6. name: example-istiocontrolplane
  7. spec:
  8. profile: default
  9. EOF

您还可以启用或禁用指定的特性或组件。例如,禁用遥测特性:

  1. $ kubectl apply -f - <<EOF
  2. apiVersion: install.istio.io/v1alpha2
  3. kind: IstioControlPlane
  4. metadata:
  5. namespace: istio-operator
  6. name: example-istiocontrolplane
  7. spec:
  8. profile: default
  9. telemetry:
  10. enabled: false
  11. EOF

参考 IstioControlPlane 接口获取完整的配置项。

卸载

删除 Istio operator 和 Istio 部署:

  1. $ kubectl -n istio-operator get IstioControlPlane example-istiocontrolplane -o=json | jq '.metadata.finalizers = null' | kubectl delete -f -
  2. $ kubectl delete ns istio-operator --grace-period=0 --force
  3. $ kubectl delete ns istio-system --grace-period=0 --force

相关内容

Installing with Istioctl

Install and customize any Istio configuration profile for in-depth evaluation or production use.

Standalone Operator Quick Start Evaluation Install [Experimental]

Instructions to install Istio in a Kubernetes cluster for evaluation.

使用 Istioctl 安装

安装和自定义任何 Istio 配置文件以进行深入评估或用于生产。

Demystifying Istio's Sidecar Injection Model

De-mystify how Istio manages to plugin its data-plane components into an existing deployment.

Diagnose your Configuration with Istioctl Analyze

Shows you how to use istioctl analyze to identify potential issues with your configuration.

Docker Desktop

在 Docker Desktop 中运行 Istio 的设置说明。