业务集群的安装 #
前置条件 #
使用 solar-operator 接管集群 #
初始化 solar-operator #
⚠️ 若集群内存在
内部负载均衡(Internal Load Balancer)
,直接初始化solar-operator即可solarctl operator init
若集群内没有内部负载均衡(Internal Load Balancer)
,使用以下命令获取ISTIOD_REMOTE_EP
export ISTIOD_REMOTE_EP=$(kubectl get nodes|awk '{print $1}' |awk 'NR==2'|xargs -n 1 kubectl get nodes -o jsonpath='{.status.addresses[0].address}')
通过ISTIOD_REMOTE_EP
初始化solar-operator
solarctl operator init --external-ip $ISTIOD_REMOTE_EP --eastwest-external-ip $ISTIOD_REMOTE_EP
安装SolarMesh组件 #
创建namespace
kubectl create ns service-mesh
创建 SolarOperator 资源。创建前,请认真查看以下内容:
⚠️
istioVersion
:istio的版本,需要对应您安装的istio版本,支持 1.9 及以上。⚠️ 若对配置不清楚,可以参考 solaroperator 配置详解。
kubectl apply -f - <<EOF
apiVersion: install.solar.io/v1alpha1
kind: SolarOperator
metadata:
name: cluster01
namespace: solar-operator
spec:
istioVersion: "1.11" ## 对应您Istio的安装版本
profile: default
EOF
查看 solar-operator
的日志
kubectl logs -f -n solar-operator -l app=solar-operator
如果看到 install solar mesh : ✔
则代表 SolarMesh 安装完成
2022-08-22T05:41:04.152061Z info creating resource: Gateway/istio-system/kiali-gateway
2022-08-22T05:41:04.171095Z info creating resource: Gateway/istio-system/prometheus-gateway
2022-08-22T05:41:04.189222Z info creating resource: VirtualService/istio-system/kiali-vs
2022-08-22T05:41:04.205080Z info creating resource: VirtualService/istio-system/prometheus-vs
2022-08-22T05:41:04.216740Z info solar graph : ✔
2022-08-22T05:41:04.260660Z info operator filter ---> :false
2022-08-22T05:41:04.261225Z info install solar mesh : ✔
以上是默认安装,也即Istio、Kiali、Prometheus等组件安装在 istio-system
命名空间,如果您的组件安装在其他的命名空间或者你有其他的场景安装需要,您可以查看自定义安装 ,或许能帮助到您。
配置SolarMesh #
Ok,现在我们的solarmesh已经安装好了,现在只要做一些小的配置,就可以玩转它了。
修改 istio-ingressgateway service的端口,增加以下配置:
$ kubectl edit svc istio-ingressgateway -n istio-system
- name: promethues ## 以下是支撑 solarmesh的配置
port: 9090
protocol: TCP
targetPort: 9090
- name: kiali
port: 20001
protocol: TCP
targetPort: 20001
- name: networking-agent
port: 7575
protocol: TCP
targetPort: 7575
- name: grafana
port: 3000
protocol: TCP
targetPort: 3000
- name: jaeger
port: 16686
protocol: TCP
targetPort: 16686
修改 istio-ingressgateway deployment的端口,增加一下配置(注意,加入的位置是在 name: istio-proxy
的下面):
$ kubectl edit deployment istio-ingressgateway -n istio-system
- containerPort: 9090
protocol: TCP
- containerPort: 20001
protocol: TCP
- containerPort: 7575
protocol: TCP
- containerPort: 9080
protocol: TCP
- containerPort: 3000
protocol: TCP
- containerPort: 16686
protocol: TCP
现在,业务集群的安装步骤已经全部完成了,我们下一步是进行业务集群的注册。
如何卸载SolarMesh? #
如果需要卸载SolarMesh,请参考solarctl uninstall
命令
➜ ~ solarctl uninstall -h
The remove subcommand installs, removes and shows the status of the operator controller.
Usage:
solarctl uninstall [command]
Available Commands:
cluster Commands related to solarmesh manifests
istio Uninstall Istio from a cluster
solarmesh The manifest command generates and diffs solarmesh manifests.
Flags:
-h, --help help for uninstall
Use "solarctl uninstall [command] --help" for more information about a command.
业务集群卸载
卸载SolarMesh的业务服务
solarctl uninstall cluster
卸载Istio
solarctl uninstall istio