共计 3450 个字符,预计需要花费 9 分钟才能阅读完成。
丸趣 TV 小编给大家分享一下 kubernetes 中 istio-1.0.0 如何部署和试用,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!
一:简介
本文介绍如何在 kubernetes1.10.4 集群中部署 istio-1.0.0 并试用 istio 自带的 bookinfo 实例应用。
二:安装
1. 获取安装包
wget
https://github.com/istio/istio/releases/download/1.0.0/istio-1.0.0-linux.tar.gz
tar -zxvf istio-1.0.0-linux.tar.gz
2. 安装 istioctl
如果手动注入 sidecar 的话需要使用这个命令:
cp istio-1.0./bin/istioctl /usr/local/bin/
设置环境变量:
ISTIO_HOME=/root/istio-1.0
PATH=$ISTIO_HOME/bin:$PATH
export ISTIO_HOME PATH
3. 安装 istio 核心组件
kubectl apply -f istio-1.0.0/install/kubernetes/istio-demo.yaml
gcr.io 和 quay.io 相关的镜像下载不了的话可以替换为自己的镜像:
daocloud.io/liukuan73/proxy_init:1.0.0
daocloud.io/liukuan73/galley:1.0.0
daocloud.io/liukuan73/mixer:1.0.0
daocloud.io/liukuan73/proxyv2:1.0.0
daocloud.io/liukuan73/pilot:1.0.0
daocloud.io/liukuan73/citadel:1.0.0
daocloud.io/liukuan73/servicegraph:1.0.0
daocloud.io/liukuan73/sidecar_injector:1.0.0
daocloud.io/liukuan73/istio-grafana:1.0.0
4. 安装结果验证
三:试用
1.sidecar 自动注入配置
Istio 装好后,如果想 sidecar 在应用启动时自动注入到 pod 中,还需要配置如下 4 步:
a. 安装 istio-sidecar-injector
安装了 istio-sidecar-injector 后,kubectl create 起应用的时候 sidecar 容器会直接自动注入到 pod 中,而不用手动注入。
b. 启用 mutating webhook admission controller
在 kube-apiserver 的启动参数的 admission controller 中按正确顺序加入如下两个 controller:MutatingAdmissionWebhook,ValidatingAdmissionWebhook
--admission-control=ServiceAccount,Initializers,NamespaceLifecycle,NamespaceExists,LimitRanger,DefaultStorageClass,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota
c. 启用 admissionregistration api
kubectl api-versions | grep admissionregistration
admissionregistration.k8s.io/v1beta1
d. 为需要自动注入 sidecar 的 namespace 打 label
kubectl label namespace istio-test istio-injection=enabled
kubectl get namespace -L istio-injection
2. 启动示例应用
a. 示例结构
b. 安装示例
kubectl apply -n istio-test -f istio-1.0.0/samples/bookinfo/platform/kube/bookinfo.yaml
c. 配置 traefik Ingress
为了便于集群外访问验证,配置 Ingress 代理
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: traefik-ingress
namespace: kube-system
spec:
rules:
- host: elasticsearch.donkey
http:
paths:
- path: /
backend:
serviceName: elasticsearch-logging
servicePort: 9200
- host: kibana.donkey
http:
paths:
- path: /
backend:
serviceName: kibana-logging
servicePort: 5601
- host: locust.donkey
http:
paths:
- path: /
backend:
serviceName: locust-master
servicePort: 8089
- host: dashboard.donkey
http:
paths:
- path: /
backend:
serviceName: kubernetes-dashboard
servicePort: 32666
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: istio-ingress
namespace: istio-system
spec:
rules:
- host: grafana.istio.donkey
http:
paths:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: traefik-ingress
namespace: kube-system
spec:
rules:
- host: elasticsearch.donkey
http:
paths:
- path: /
backend:
serviceName: elasticsearch-logging
servicePort: 9200
- host: kibana.donkey
http:
paths:
- path: /
backend:
serviceName: kibana-logging
servicePort: 5601
- host: locust.donkey
http:
paths:
- path: /
backend:
serviceName: locust-master
servicePort: 8089
- host: dashboard.donkey
http:
paths:
- path: /
backend:
serviceName: kubernetes-dashboard
servicePort: 32666
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: istio-ingress
namespace: istio-system
spec:
rules:
- host: grafana.istio.donkey
http:
paths:
- path: /
backend:
serviceName: grafana
servicePort: 3000
- host: zipkin.istio.donkey
http:
3. 示例验证
a.bookinfo 示例
http://productpage.donkey/productpage?u=normal
b. 监控
http://grafana.istio.donkey
c.Prometheus 页面 http://prometheus.istio.donkey
d.ServiceGraph 页面
看完了这篇文章,相信你对“kubernetes 中 istio-1.0.0 如何部署和试用”有了一定的了解,如果想了解更多相关知识,欢迎关注丸趣 TV 行业资讯频道,感谢各位的阅读!