Myluzh Blog

Strive to become a dream architect.

K8S Istio安装以及入门(使用istioctl安装)

发布时间: 2024-1-31 文章作者: myluzh 分类名称: Kubernetes


0x01 安装istio
[root@k8s-master01 istio]# wget https://github.com/istio/istio/releases/download/1.20.2/istio-1.20.2-linux-amd64.tar.gz
[root@k8s-master01 istio]# tar -zxvf istio-1.20.2-linux-amd64.tar.gz 
[root@k8s-master01 istio]# cd istio-1.20.2/bin/
# 对于本次安装,我们采用 demo 配置组合。https://istio.io/latest/zh/docs/setup/additional-setup/config-profiles/
[root@k8s-master01 bin]# ./istioctl install --set profile=demo -y
✔ Istio core installed                                                                                                    
✔ Istiod installed                                                                                                        
✔ Egress gateways installed                                                                                               
✔ Ingress gateways installed                                                                                              
✔ Installation complete                                                                                                   Made this installation the default for injection and validation.
# 安装完成
[root@k8s-master01 bin]# kubectl get pod -A | grep istio
istio-system    istio-egressgateway-684596759b-hhcgg                     1/1     Running     0              4m28s
istio-system    istio-ingressgateway-56c8df6d5d-tcdzd                    1/1     Running     0              4m28s
istio-system    istiod-cd9fcbdf7-nvbjb                                   1/1     Running     0              4m44s
给命名空间添加标签,指示 Istio 在部署应用的时候,自动注入 Envoy 边车代理
[root@k8s-master01 bin]# kubectl label namespace default istio-injection=enabled
namespace/default labeled

0x02 部署示例应用
# 部署 Bookinfo 示例应用
[root@k8s-master01 istio-1.20.2]# kubectl apply -f samples/bookinfo/platform/kube/bookinfo.yaml
service/details created
serviceaccount/bookinfo-details created
deployment.apps/details-v1 created
...
# 等待资源完成 通过检查返回的页面标题来验证应用是否已在集群中运行,并已提供网页服务:
[root@k8s-master01 istio-1.20.2]# kubectl exec "$(kubectl get pod -l app=ratings -o jsonpath='{.items[0].metadata.name}')" -c ratings -- curl -sS productpage:9080/productpage | grep -o "<title>.*</title>"
# 修改为nodeport类型
[root@k8s-master01 istio-1.20.2]# kubectl edit svc  productpage
# 查看nodeport端口 这边为31166 访问http://nodeip:31166/productpage 查看页面
[root@k8s-master01 istio-1.20.2]# kubectl get svc | grep productpage
productpage       NodePort    10.43.26.232            9080:31166/TCP      93m


0x03 安装kiali仪表盘
[root@k8s-master01 istio-1.20.2]# kubectl apply -f samples/addons
# 等待完成
[root@k8s-master01 istio-1.20.2]# kubectl rollout status deployment/kiali -n istio-system
deployment "kiali" successfully rolled out
# 修改kiali为nodeport
[root@k8s-master01 istio-1.20.2]# kubectl edit  svc  kiali -n istio-system
#查看nodeport端口 这边为 http://nodeip:32027/
[root@k8s-master01 istio-1.20.2]# kubectl get svc  -n istio-system | grep kiali
kiali                  NodePort       10.43.152.154   <none>        20001:32027/TCP,9090:32099/TCP



0x99 参考连接
istio入门文档 https://istio.io/latest/zh/docs/setup/getting-started/

标签: istio service mesh istioctl

发表评论