Isito 部署
方法一:使用 istioctl 部署
# tar -zxvf istio-1.20.0-linux-amd64.tar.gz
# cd istio-1.20.0/bin/
# cp -rp istioctl /usr/bin/
# istioctl version
# istioctl profile list
# istioctl install --manifests=manifests/
# kubectl get pods -A
# Istio 默认启用自动 Sidecar 注入,为 default 命名空间打上标签 istio-injection=enabled。
# kubectl label namespace default istio-injection=enabled
配置更新
# istioctl upgrade --manifests=manifests/
卸载
# istioctl uninstall --purge
部署bookinfo示例
Bookinfo 应用分为四个单独的微服务:
Bookinfo 应用分为四个单独的微服务:
- productpage :productpage 微服务会调用 details 和 reviews 两个微服务,用来生成页面。
- details :这个微服务包含了书籍的信息。
- reviews :这个微服务包含了书籍相关的评论。它还会调用 ratings 微服务。
- ratings :ratings 微服务中包含了由书籍评价组成的评级信息。
- reviews 微服务有 3 个版本:
v1 版本不会调用 ratings 服务。
v2 版本会调用 ratings 服务,并使用 1 到 5 个黑色星形图标来显示评分信息。
v3 版本会调用 ratings 服务,并使用 1 到 5 个红色星形图标来显示评分信息。
# kubectl apply -f samples/bookinfo/platform/kube/bookinfo.yaml
要确认 Bookinfo 应用程序正在运行,请通过某个 pod 中的 curl 命令向其发送请求,例如来自 ratings:
# kubectl exec -it $(kubectl get pod -l app=ratings -o jsonpath='{.items[0].metadata.name}') -c ratings -- curl productpage:9080/productpage | grep -o "<title>.*</title>"
部署BookIno-Gateway
为应用程序定义入口网关
# kubectl apply -f /root/istio-1.20.0/samples/bookinfo/networking/bookinfo-gateway.yaml
# kubectl get gateway
# kubectl get svc -n istio-system istio-ingressgateway -o yaml
访问测试服务
# curl <INGRESS-IP>:<INGRESS-PORT>/productpage
# curl 192.168.61.241:30526/productpage
方法二:使用 Istio Operator 部署
[root@cubestduio istio-1.20.0]# istioctl operator init
Installing operator controller in namespace: istio-operator using image: docker.io/istio/operator:1.20.0
Operator controller will watch namespaces: istio-system
✔ Istio operator installed
✔ Installation complete
[root@cubestduio istio-1.20.0]# kubectl get pods -A
NAMESPACE NAME READY STATUS RESTARTS AGE
infra kubeflow-dashboard-6c74477c8b-twvcw 1/1 Running 9 (2d6h ago) 6d6h
infra kubeflow-dashboard-frontend-59c655796c-s5rv6 1/1 Running 2 (2d6h ago) 6d6h
infra kubeflow-dashboard-schedule-648d9dd99d-25r2g 1/1 Running 1 (2d6h ago) 6d6h
infra kubeflow-dashboard-worker-64f4dfd68d-xlvvz 1/1 Running 1 (2d6h ago) 6d6h
infra kubeflow-watch-684cf4784-czrx6 1/1 Running 3 (19h ago) 6d6h
infra mysql-59d54cdd87-dndwm 1/1 Running 3 (2d6h ago) 6d6h
infra redis-6bff67f66f-jfcpm 1/1 Running 1 (2d6h ago) 6d6h
istio-operator istio-operator-56994648d7-sc6fb 1/1 Running 0 90s
istio-system istio-ingressgateway-f88756b4b-9ctvk 1/1 Running 1 (2d6h ago) 6d6h
istio-system istiod-75f5fff5d9-nn2qm 1/1 Running 1 (2d6h ago) 6d6h
kube-system calico-kube-controllers-57b57c56f-lmmn4 1/1 Running 15 (2d6h ago) 8d
kube-system calico-node-n82pz 1/1 Running 1 (2d6h ago) 8d
kube-system coredns-5bbd96d687-qxr9l 1/1 Running 1 (2d6h ago) 8d
kube-system coredns-5bbd96d687-tqhfv 1/1 Running 1 (2d6h ago) 8d
kube-system dashboard-cluster-metrics-scraper-869d7c5db-kcpzq 1/1 Running 1 (2d6h ago) 6d6h
kube-system etcd-cubestduio 1/1 Running 1 (2d6h ago) 8d
kube-system kube-apiserver-cubestduio 1/1 Running 5 (2d6h ago) 8d
kube-system kube-controller-manager-cubestduio 1/1 Running 12 (2d6h ago) 8d
kube-system kube-proxy-qt88w 1/1 Running 1 (2d6h ago) 8d
kube-system kube-scheduler-cubestduio 1/1 Running 12 (2d6h ago) 8d
kube-system kubeflow-prometheus-adapter-6ff8f485c8-ds9wh 1/1 Running 9 (2d6h ago) 6d6h
kube-system kubernetes-dashboard-cluster-d747866c4-jphcj 1/1 Running 0 6d6h
kubeflow minio-66c7586f8d-cd6ht 1/1 Running 9 6d6h
kubeflow training-operator-7cd5cd6745-d7ghf 1/1 Running 0 6d6h
kubeflow volcano-controllers-744fc569b7-q49lv 1/1 Running 1 (2d6h ago) 6d6h
kubeflow volcano-scheduler-647c9cc849-9hl5z 1/1 Running 1 (2d6h ago) 6d6h
kubeflow workflow-controller-c59fb6b4c-kfwzl 1/1 Running 21 (2d6h ago) 6d6h
monitoring grafana-dcdf7cd44-wq95c 1/1 Running 1 (2d6h ago) 6d6h
monitoring node-exporter-g5k8h 2/2 Running 2 (2d6h ago) 2d14h
monitoring prometheus-k8s-0 2/2 Running 1 (2d6h ago) 2d6h
monitoring prometheus-operator-5cb64bdc6c-kfvtz 1/1 Running 1 (2d6h ago) 6d6h
[root@cubestduio istio-1.20.0]# kubectl apply -f samples/addons
serviceaccount/grafana created
configmap/grafana created
service/grafana created
deployment.apps/grafana created
configmap/istio-grafana-dashboards created
configmap/istio-services-grafana-dashboards created
deployment.apps/jaeger created
service/tracing created
service/zipkin created
service/jaeger-collector created
serviceaccount/kiali created
configmap/kiali created
clusterrole.rbac.authorization.k8s.io/kiali-viewer created
clusterrole.rbac.authorization.k8s.io/kiali created
clusterrolebinding.rbac.authorization.k8s.io/kiali created
role.rbac.authorization.k8s.io/kiali-controlplane created
rolebinding.rbac.authorization.k8s.io/kiali-controlplane created
service/kiali created
deployment.apps/kiali created
serviceaccount/loki created
configmap/loki created
configmap/loki-runtime created
service/loki-memberlist created
service/loki-headless created
service/loki created
statefulset.apps/loki created
serviceaccount/prometheus created
configmap/prometheus created
clusterrole.rbac.authorization.k8s.io/prometheus created
clusterrolebinding.rbac.authorization.k8s.io/prometheus created
service/prometheus created
deployment.apps/prometheus created
[root@cubestduio istio-1.20.0]# kubectl get po -n istio-system
NAME READY STATUS RESTARTS AGE
grafana-7bd5db55c4-4qc5z 1/1 Running 0 9m7s
istio-ingressgateway-f88756b4b-9ctvk 1/1 Running 1 (2d6h ago) 6d7h
istiod-75f5fff5d9-nn2qm 1/1 Running 1 (2d6h ago) 6d7h
jaeger-78756f7d48-4rbm6 1/1 Running 0 9m7s
kiali-55bfd5c754-q9vhb 1/1 Running 0 9m5s
prometheus-67f6764db9-fhvk5 2/2 Running 0 9m3s
[root@cubestduio istio-1.20.0]# istioctl dashboard --address 0.0.0.0 -p 20001 kiali
http://0.0.0.0:20001/kiali
作者:一毛
本博客所有文章仅用于学习、研究和交流目的,欢迎非商业性质转载。
不管遇到了什么烦心事,都不要自己为难自己;无论今天发生多么糟糕的事,都不应该感到悲伤。记住一句话:越努力,越幸运。