在学习helm部署相关服务过程中出现一些相关问题,自己记录并供大家一起学习!!!
【问题1】部署helm 获取软件包失败
在通过wget https://storage.googleapis.com/kubernetes-helm/helm-v2.13.1-linux-amd64.tar.gz文件过程发现无法获取,提示403 :Forbidden
可以通过如下方式获取
链接:https://pan.baidu.com/s/17OnWVaAO433llgOy-Oopbg
提取码:dptr
下载完成后进行安装
tar -zxvf helm-v2.13.1-linux-amd64.tar.gz
cd linux-amd64/
cp helm /usr/local/bin/
【问题2】helm 部署tiller时无镜像文件
镜像文件:helm-tiller.tar
链接:https://pan.baidu.com/s/1VN0BXo1agubrcNTgW6UXWg
提取码:38qi
下载后导入到容器中
docker load -i helm-tiller.tar
【问题3】 helm init 提示报错Error: error installing: the server could not find the requested resource
因为 1.16.0 版本之后 Deployment 的apiVersion的 endpoint 发生变化,所以可以通过以下方式:方式1、修改文件内容,实现兼容;
方式2、安装更高版本,比如v2.17.0 或 v3.5.2
方式1解决:
将helm配置导出到tiller.yaml
helm init --output yaml > tiller.yaml
编辑tiller.yaml
将extensions/v1beta1修改为 apiVersion: apps/v1
在spec的 strategy: {} 后面新增
selector:
matchLabels:
app: helm
name: tiller
---
apiVersion: apps/v1 ###修改
kind: Deployment
metadata:
creationTimestamp: null
labels:
app: helm
name: tiller
name: tiller-deploy
namespace: kube-system
spec:
replicas: 1
strategy: {}
selector: ###新增
matchLabels: ###新增
app: helm ###新增
name: tiller ###新增
template:
metadata:
creationTimestamp: null
labels:
app: helm
name: tiller
完成后运行yaml文件
kubectl apply -f tiller.yaml
[root@k8s-master01 helm]# kubectl apply -f tiller.yaml
deployment.apps/tiller-deploy created
service/tiller-deploy created
[root@k8s-master01 helm]#
[root@k8s-master01 helm]# kubectl get pod -A -owide | grep tiller
kube-system tiller-deploy-56b4cf59c4-pjb2x 1/1 Running 0 10m 10.2.85.193 k8s-node01 <none> <none>
[root@k8s-master01 helm]#
[root@k8s-master01 helm]#
[root@k8s-master01 helm]#
[root@k8s-master01 helm]# kubectl get deployment -n kube-system
NAME READY UP-TO-DATE AVAILABLE AGE
calico-kube-controllers 1/1 1 1 22m
coredns 2/2 2 2 35m
tiller-deploy 1/1 1 1 10m
[root@k8s-master01 helm]#
[root@k8s-master01 helm]# kubectl get service -n kube-system
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kube-dns ClusterIP 10.96.0.10 <none> 53/UDP,53/TCP,9153/TCP 36m
tiller-deploy ClusterIP 10.100.90.19 <none> 44134/TCP 11m
【问题4】helm ls 提示Error: configmaps is forbidden: User "system:serviceaccount:kube-system:default" cannot list resource "configmaps" in API group "" in the namespace "kube-system"
[root@k8s-master01 hello-world]# helm ls
Error: configmaps is forbidden: User "system:serviceaccount:kube-system:default" cannot list resource "configmaps" in API group "" in the namespace "kube-system"
执行如下命令:
kubectl create serviceaccount --namespace kube-system tiller
kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
kubectl patch deploy --namespace kube-system tiller-deploy -p '{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}'
helm init --service-account tiller --upgrade
【问题5】使用helm 创建tiller-deploy 异常,Pod提示NetworkPlugin cni failed to set up .. network:open/run/flannel/subnet.env:nosuchfileordirectory
具体可以参考Pod提示NetworkPlugin cni failed to set up .. network:open/run/flannel/subnet.env:nosuchfileordirectory_好好学习之乘风破浪的博客-CSDN博客
【问题6】helm 部署dashborad 中 helm fetch stable/kubernetes-dashborad异常
用helm 部署dashborad 中 使用fetch下载dashboard
helm fetch stable/kubernetes-dashborad
Error: no cached repo found. (try 'helm repo update'). open /root/.helm/repository/cache/stable-index.yaml: no such file or directory
则需要更新一下helm的仓库源
helm repo update
如果在更新仓库源中出现错误:
Failed to fetch https://kubernetes-charts.storage.googleapis.com/index.yaml : 403 Forbidden
更新为阿里的地址
helm repo remove stable
helm repo add stable https://charts.helm.sh/stable
helm repo update
如果还是不行可以更新微软的地址
helm repo add stable http://mirror.azure.cn/kubernetes/charts/
可以后下载dashboard
helm fetch stable/kubernetes-dashborad
进行包的解压
tar -zxvf kubernetes-dashboard-1.11.1.tgz
【问题7】进入dashboard页面后提示报错