kiali

分享到:

kiali

https://istio.io/docs/setup/getting-started/

[TOC]

kiali

istio的管理界面 https://github.com/kiali/kiali

安装1.5

安装istioctl

 1curl -L https://istio.io/downloadIstio | sh -
 2or 
 3自己下载
 4tar -zxvf istio-1.5.1-linux.tar.gz
 5
 6cd istio-1.5.1
 7
 8将istioctl客户端添加到您的路径(Linux或macOS):
 9当前终端有效 export PATH=$PWD/bin:$PATH
10
11vi ~/.bashrc
12export PATH=/root/istio-1.5.1/bin:$PATH
13
14source ~/.bashrc

安装 istio

1istioctl manifest apply --set profile=demo
x default demo minimal remote
Core components
istio-egressgateway X
istio-ingressgateway X X
istio-pilot X X X
Addons
grafana X
istio-tracing X
kiali X
prometheus X X X

面板UI

1istioctl dashboard --help
2
3istioctl dashboard kiali
4istioctl dashboard grafana
5istioctl dashboard jaeger
6istioctl dashboard controlz
7
8不能访问

方式二

 1kubectl get services -n istio-system -o wide
 2
 3grafana           3000
 4jaeger-query             16686/TCP 
 5kiali                 20001/TCP 
 6prometheus             9090/TCP 
 7zipkin                     9411/TCP 
 8
 9kubectl --namespace istio-system  port-forward --address 0.0.0.0 svc/kiali 20001
10默认 admin admin
11
12kubectl --namespace istio-system  port-forward --address 0.0.0.0 svc/jaeger-query 16686
13
14kubectl --namespace istio-system  port-forward --address 0.0.0.0 svc/grafana 3000

卸载

1istioctl manifest generate --set profile=demo | kubectl delete -f -

安装 1.4

1. 下载

 1curl -L https://istio.io/downloadIstio | sh -
 2
 3cd istio-1.4.2
 4
 5export PATH=$PWD/bin:$PATH
 6或者直接下载
 7https://github.com/istio/istio/releases
 8
 9istioctl-1.4.2-linux.tar.gz
10解压
11tar -zxvf istioctl-1.4.2-linux.tar.gz
12
13拷贝istioctl到 root/bin

2. Install the demo profile

1istioctl manifest apply --set profile=demo
2
3kubectl get svc -n istio-system
4
5kubectl get pods -n istio-system

profile

X 代表有

0 default demo minimal sds remote
Core components
istio-citadel X X X X
istio-egressgateway X
istio-galley X X X
istio-ingressgateway X X X
istio-nodeagent X
istio-pilot X X X X
istio-policy X X X
istio-sidecar-injector X X X X
istio-telemetry X X X
Addons
grafana X
istio-tracing X
kiali X
prometheus X X X

3. 使用

当您使用kubectl apply部署应用程序时,如果在标有istio-injection = enabled的命名空间中启动Envoy容器,则Istio sidecar注入器将自动将Envoy容器注入到您的应用程序pod中:

1$ kubectl label namespace <namespace> istio-injection=enabled
2$ kubectl create -n <namespace> -f <your-app-spec>.yaml
3
4# 关闭注入
5kubectl label namespace default istio-injection-

在没有istio-injection标签的名称空间中,可以使用istioctl kube-inject在部署它们之前在应用程序pod中手动注入Envoy容器:

1istioctl kube-inject -f <your-app-spec>.yaml | kubectl apply -f -
2
3# 或者
4
5kubectl apply -f <(istioctl kube-inject -f sleep.yaml)

4. Uninstall

1istioctl manifest generate --set profile=demo | kubectl delete -f -

例子

开启手工注入

1kubectl create namespace istio-test
2
3kubectl label namespace istio-test istio-injection=enabled
4
5# 查看
6kubectl get namespace -L istio-injection

create pod

https://github.com/istio/istio/blob/1.4.0/samples/sleep/sleep.yaml

11. yaml里没有命名空间
2kubectl create -n istio-test -f sleep.yaml
3
4kubectl -n istio-test get pod
5能看到ready是2/2
6
72. yaml里有命名空间
8kubectl create -f sleep.yaml
9

如果有sidecar.istio.io/inject 参数,以这个为准,不管命名空间是否开启或者关闭注入

 1apiVersion: apps/v1
 2kind: Deployment
 3metadata:
 4  name: ignored
 5spec:
 6  template:
 7    metadata:
 8      annotations:
 9        sidecar.istio.io/inject: "false"
10    spec:
11      containers:
12      - name: ignored
13        image: tutum/curl
14        command: ["/bin/sleep","infinity"]

查看资源

 1# 查看资源
 2kubectl top pod -n istio-test
 3
 4输出
 5NAME                    CPU(cores)   MEMORY(bytes)   
 6sleep-f8cbf5b76-pc4b5   4m           31Mi 
 7
 8# 关闭自动注入
 9kubectl label namespace istio-test istio-injection-
10
11# 删除pod
12kubectl delete pod -n istio-test -l app=sleep
13
14# 查看pod
15kubectl -n istio-test get pod
16
17ready 变成1了
18
19
20# 查看资源
21kubectl top pod -n istio-test
22
23输出
24NAME                    CPU(cores)   MEMORY(bytes)   
25sleep-f8cbf5b76-vqxp9   0m           0Mi