当前位置:   article > 正文

Istio 最新版1.7.6版本安装及问题_mountvolume.setup failed for volume "istio-token"

mountvolume.setup failed for volume "istio-token" : failed to fetch token: t

本文采用k8s进行安装,其他安装方式请查看官网

一、环境准备

  1. github下载安装包

下载地址:istio安装地址
image-20201225193542625

二、安装步骤

  1. 解压缩

    tar -zxf istio-1.7.6-linux.amd64.tar.gz

  2. 配置istioctl环境

    export PATH=$PWD/bin:$PATH

    或者将istioctl移动到/usr/local/bin

    如:mv bin/istioctl /usr/local/bin

  3. 导出yaml文件

    istioctl manifest generate --set profile=demo > ./deploy.yaml

    这里采用profile=demo.根据官网的描述,不同的profile会自动安装不同的插件。
    官网地址:https://istio.io/latest/zh/docs/setup/additional-setup/config-profiles/

  4. 安装istio

    kubectl apply -f deploy.yaml

三、结果查看

  1. 查看pod情况:kubectl get pods -n istio-system

如果全部pod处于running状态是最好的。

这里查看pod可能会发现有pod一直处于creating状态,通过describe命令可知“istio-token”找不到:

MountVolume.SetUp failed for volume "istio-token":failed to fetch token: the API server does not have TokenRequest endpoints enabled

通过查看官网可知:

istio官网描述

为了通过istio控制平面进行身份验证,Istio代理将使用服务账户令牌,Kubernetes支持以下两种形式的令牌:

  1. 第三方令牌,该令牌具有一定范围的受众和有效期
  2. 没有过期且已安装到所有pod里面的第一方令牌

由于第一方令牌的属性安全性较低,因此istio将默认使用第三方令牌。

我们先查看我们的k8s集群是否支持第三方令牌:

$ kubectl get --raw /api/v1 | jq '.resources[] | select(.name | index("serviceaccounts/token"))'
  • 1

如果输出指令后输出:

{
    "name": "serviceaccounts/token",
    "singularName": "",
    "namespaced": true,
    "group": "authentication.k8s.io",
    "version": "v1",
    "kind": "TokenRequest",
    "verbs": [
        "create"
    ]
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

则支持第三方令牌。

假设不支持第三方令牌,那么需要指定使用第一方令牌:

使用以下命令重新生成新的yaml文件并且运行,在此之前先删除之前的yaml

istioctl manifest generate --set profile=demo --set values.global.jwtPolicy=first-party-jwt > ./deploy.yaml

那么如何支持第三方令牌(Third-party-jwt) 呢?

往apiserver添加参数即可:

  1. /etc/kubernetes/manifests/kube-apiserver.yaml里添加:
- --service-account-signing-key-file=/etc/kubernetes/pki/sa.key
- --service-account-key-file=/etc/kubernetes/pki/sa.pub
- --service-account-issuer=api
- --service-account-api-audiences=api,vault,factors
  • 1
  • 2
  • 3
  • 4
  1. 接着kubectl apply -f kube-apiserver.yaml更新即可

四、安装结果

最后进行验证:

istioctl verify-install -f ./deploy.yaml

image-20201225194456004

出现如图语句则安装完成了!

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小桥流水78/article/detail/797288
推荐阅读
相关标签
  

闽ICP备14008679号