首页
学习
活动
专区
圈层
工具
发布

istio安装使用

一、安装

1.1、安装istio
代码语言:javascript
复制
# 安装
# 下载
https://github.com/istio/istio/releases/download/1.13.2/istio-1.13.2-linux-amd64.tar.gz
tar -xvf istio-1.13.2-linux-amd64.tar.gz
cp /root/istio-1.13.2/bin/istioctl /usr/local/bin/
​
istioctl version
istioctl operator init
​
vim default-install.yaml
​
apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
metadata:
  namespace: istio-system
  name: istio-operator
spec:
  profile: default
  components:
    ingressGateways:
      - name: istio-ingressgateway
        enabled: true
        k8s:
          resources:
            requests:
              cpu: 200m
          serviceAnnotations:
            cloud.google.com/load-balancer-type: "internal"
          service:
            type: NodePort
            ports:
            - port: 15020
              nodePort: 30520
              name: status-port
            - port: 80
              targetPort: 8080
              nodePort: 30080
              name: http2
            - port: 443
              nodePort: 30443
              targetPort: 8443
              name: https
​
​
istioctl manifest apply -f default-install.yaml
1.2、安装kiali
代码语言:javascript
复制
# 安装kiali
cd /root/istio-1.13.2/samples/addons
kubectl apply -f kiali.yaml
​
# ingress配置
kubectl create secret tls test-secret --cert=www.test.com.crt --key=www.test.com.key -n istio-system
​
vim kiali-ingress-https.yaml
​
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: kiali
  namespace: istio-system
  annotations:
    kubernetes.io/ingress.class: "nginx"
spec:
  tls:
    - hosts:
        - kiali.test.com
      secretName: test-secret
  rules:
    - host: kiali.test.com
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: kiali
                port:
                  name: http
​
​
kubectl apply -f kiali-ingress-https.yaml -n istio-system
​
1.3、安装jaeger
代码语言:javascript
复制
# 安装jaeger
cd /root/istio-1.13.2/samples/addons
kubectl apply -f jaeger.yaml
1.4、安装prometheus,grafana
代码语言:javascript
复制
# 安装prometheus,grafana
cd /root/istio-1.13.2/samples/addons
kubectl apply -f prometheus.yaml
kubectl apply -f grafana.yaml

二、使用测试

2.1、部署演示项目bookinfo
代码语言:javascript
复制
# 部署演示项目bookinfo
kubectl create ns bookinfo
kubectl label ns bookinfo istio-injection=enabled
cd /root/istio-1.13.2/samples/bookinfo/platform/kube
kubectl apply -f bookinfo.yaml -n bookinfo
2.2、gateway,VirtualService配置
代码语言:javascript
复制
# ingress gateway
# 
vim bookinfo-gateway.yaml

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: bookinfo-gateway
spec:
  selector:
    istio: ingressgateway # use istio default controller
  servers:
  - port:
      number: 443
      name: https
      protocol: HTTPS
    tls:
      mode: SIMPLE
      credentialName: "test-secret"
    hosts:
    - "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: bookinfo
spec:
  hosts:
  - "bookinfo.test.com"
  gateways:
  - bookinfo-gateway
  http:
  - match:
    - uri:
        exact: /productpage
    - uri:
        prefix: /static
    - uri:
        exact: /login
    - uri:
        exact: /logout
    - uri:
        prefix: /api/v1/products
    route:
    - destination:
        host: productpage
        port:
          number: 9080
下一篇
举报
领券