• k8s 安装 istio 的坑


    本文针对于二进制部署的k8s安装istio1.67版本

    没有设置admin.conf的小伙伴请参考

    https://www.cnblogs.com/Tempted/p/13469772.html

    1、检查k8s dns svc 启动是否正常

    istio pod 访问不到svc错误,请检查K8S 上dns服务是否正常

    error   citadelclient   Failed to create certificate: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing dial tcp: lookup istiod.istio-system.svc on 10.254.0.2:53: read udp 172.30.1.57:52724->10.254.0.2:53: i/o timeout"

    2、master 上需要部署一个node节点,并设置为不可调度

    1,不可调度
    
    kubectl cordon master
    kubectl uncordon master       #取消
    
    2,驱逐已经运行的业务容器
    kubectl drain --ignore-daemonsets --delete-local-data  master
    
    3,如果想删除node 节点,则进行这个步骤
    kubectl delete node master
    

       

    istio自动注入错误

    Error creating: Internal error occurred: failed calling webhook "sidecar-injector.istio.io": Post https://istio-sidecar-injector.istio-system.svc:443/inject?timeout=30s: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
    

     

    此错误是因为master节点访问不了集群内部的Service(istio-sidecar-injector),导致自动注入失败。 

      

    安装istio

    一、下载

    官方地址:

    https://preliminary.istio.io/latest/zh/docs/setup/getting-started/

    github 下载地址

    https://github.com/istio/istio/releases/

    二、配置

    [root@master ~]#  tar -zxf istio-1.6.7-linux-amd64.tar.gz
    
    [root@master ~]#  cd istio-1.6.7
    
    添加istioctl 环境变量
    [root@master ~]#  vi ~/.bash_profile
    # .bash_profile
    # Get the aliases and functions
    if [ -f ~/.bashrc ]; then
            . ~/.bashrc
    fi
    
    # User specific environment and startup programs
    
    PATH=$PATH:$HOME/bin
    PATH=$PATH:/root/istio-1.6.7/bin
    
    export PATH
    
    [root@master ~]#  source ~/.bash_profile
    
    添加istio自动补全工具
    [root@master ~]# cp  tools/istioctl.bash ~/.istioctl.bash
    
    [root@master ~]# source  ~/.istioctl.bash

      

    c-bash: _get_comp_words_by_ref: command not found 碰到这样的错误解决方法:

    yum install bash-completion -y
    
    source /usr/share/bash-completion/bash_completion
    
    source ~/.istioctl.bash

     

    k8s 自动补全

    source <(kubectl completion bash)
    echo "source <(kubectl completion bash)" >> ~/.bashrc
    
    #添加kubectl的k别名
    vim   ~/.bashrc 
    alias k='kubectl'
      
    #tab命令只在使用完整的kubectl 命令起作用,使用别名k 时不起作用,修补:
     source <( kubectl completion bash | sed 's/kubectl/k/g' )  #写入 .bashrc 

     

    三、安装

        以官方为主:https://preliminary.istio.io/latest/zh/docs/setup/getting-started/

     1、安装demo配置

      istioctl manifest apply --set profile=demo

        2、添加自动注入

           kubectl create ns name

           kubectl label namespace <namespace> istio-injection=enabled

           kubectl apply -n <namespace> -f <your-app-spec>.yaml

           一个自动注入yaml demo     

      

    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: demo
      labels:
        app: demo
    spec:
      replicas: 1
      selector:
        matchLabels:
          app: demo
      template:
        metadata:
          labels:
            app: demo
        spec:
          containers:
          - name: nginx
            image: nginx:1.14-alpine
            imagePullPolicy: IfNotPresent
            ports:
            - containerPort: 80

        3、卸载

      istioctl manifest generate --set profile=demo | kubectl delete -f -

  • 相关阅读:
    链表的逆置(无聊而写)
    C
    大型分布式站点的技术需求
    leetcode第一刷_Best Time to Buy and Sell Stock
    微商行业面临洗礼,微盟萌店是否能完毕“神补刀”?
    oracle函数 CONCAT(c1,c2)
    oracle函数 CHR(n1)
    oracle函数 ASCII(x1)
    oracle函数 INTERVAL c1 set1
    oracle函数 SESSIONTIMEZONE
  • 原文地址:https://www.cnblogs.com/Tempted/p/13496917.html
Copyright © 2020-2023  润新知