删除Helm使用时关于kubernetes文件的警告问题

删除Helm使用时关于kubernetes文件的警告

使用helm命令行时如果有以下警告信息:

zhang@zhang:~$ helm ls
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /home/zhang/.kube/config
WARNING: Kubernetes configuration file is world-readable. This is insecure. Location: /home/zhang/.kube/config
NAME                NAMESPACE    REVISION    UPDATED                                    STATUS      CHART          APP VERSION
mysql-1617157855    default      1           2021-03-31 10:30:57.988087373 +0800 CST    deployed    mysql-1.6.9    5.7.30

前两行警告信息的意思是当前使用的kubernetes的配置文件不安全,同用户组的用户和其他用户都可以读取这个文件,查看如下:

zhang@zhang:~$ ll .kube/config 
-rw-rw-r-- 1 zhang zhang 4652 3月  17 12:30 .kube/config

可以看到组内用户拥有读写权限(第二个rw),其他用户拥有读权限(第三个r)。

解决这个告警,修改权限即可:

zhang@zhang:~$ chmod g-rw ~/.kube/config
zhang@zhang:~$ chmod o-r ~/.kube/config

再次执行helm命令,告警信息已经没有了:

zhang@zhang:~$ helm ls
NAME                NAMESPACE    REVISION    UPDATED                                    STATUS      CHART          APP VERSION
mysql-1617157855    default      1           2021-03-31 10:30:57.988087373 +0800 CST    deployed    mysql-1.6.9    5.7.30 

执行helm警告kube/config文件不安全问题

# helm list
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /root/.kube/config
WARNING: Kubernetes configuration file is world-readable. This is insecure. Location: /root/.kube/config
NAME    NAMESPACE       REVISION        UPDATED                                 STATUS          CHART                   APP VERSION
jmeter  default         1               2021-06-30 14:24:54.191846532 +0800 CST deployed        jmeter-suite-1.0.1      1.16.0

解决

# chmod g-rw ~/.kube/config
# chmod o-r ~/.kube/config

再次执行就不会出现告警信息了

作者:JosephThatwho原文地址:https://blog.csdn.net/JosephThatwho/article/details/115344730

%s 个评论

要回复文章请先登录注册