小编给大家分享一下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如何部署和试用”有了一定的了解,如果想了解更多相关知识,欢迎关注天达云行业资讯频道,感谢各位的阅读!