k8s--基础--25.2--Helm--安装helm服务端tiller
1.1、脚本内容1.2、执行把下面的tar.gz包传到master节点和各个node节点,并安装3、安装tiler在master1上操作3.1、脚本内容3.2、执行通过上面几步helm服务端旧部属好了
·
k8s–基础–25.2–Helm–安装helm服务端tiller
1、创建sa账号和对sa账号做rbac授权
- 在master1上操作
- 参考资料
https://github.com/helm/helm/blob/master/docs/rbac.md
1.1、脚本
vi /root/helm/rbac.yaml
内容
# 创建sa账号
apiVersion: v1
kind: ServiceAccount
metadata:
# sa账号
name: tiller
# 名称空间
namespace: kube-system
---
# 对sa账号做rbac授权
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: tiller
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
# sa账号设置
- kind: ServiceAccount
name: tiller
namespace: kube-system
1.2、执行
kubectl apply -f /root/helm/rbac.yaml
# 查看
kubectl get sa -n kube-system | grep tiller
2、安装镜像
把下面的tar.gz包传到master节点和各个node节点,并安装
2.1、上传镜像
2.2、解压
mkdir -p /root/helm
cd /root/helm
docker load -i tiler_2_13_1.tar.gz
# 删除
rm -rf tiler_2_13_1.tar.gz
3、安装tiler
- 在master1上操作
3.1、脚本
vi /root/helm/tiller.yaml
内容
apiVersion: v1
kind: Service
metadata:
creationTimestamp: null
# Service 标签为 app: helm和name: tiller
labels:
app: helm
name: tiller
# Service 名称为tiller-deploy
name: tiller-deploy
# 名称空间是kube-system
namespace: kube-system
spec:
# service的端口
ports:
#端口名称
- name: tiller
#端口
port: 44134
#目标端口44134
targetPort: tiller
# 匹配的pod标签
selector:
app: helm
name: tiller
type: ClusterIP
status:
loadBalancer: {}
---
apiVersion: apps/v1
kind: Deployment
metadata:
creationTimestamp: null
# 设置Deployment标签
labels:
app: helm
name: tiller
# 设置Deployment名称
name: tiller-deploy
namespace: kube-system
spec:
# 匹配的模板标签
selector:
matchLabels:
app: helm
name: tiller
# 副本数
replicas: 1
strategy: {}
# 定义模板
template:
metadata:
creationTimestamp: null
# 模板标签
labels:
app: helm
name: tiller
spec:
# 将sa账号默认挂载到 Pod 中
automountServiceAccountToken: true
# sa账号
serviceAccount: tiller
# 定义容器
containers:
# 环境变量
- env:
- name: TILLER_NAMESPACE
value: kube-system
- name: TILLER_HISTORY_MAX
value: "0"
# 镜像地址
image: gcr.io/kubernetes-helm/tiller:v2.13.1
imagePullPolicy: IfNotPresent
# 存好检查
livenessProbe:
httpGet:
path: /liveness
port: 44135
initialDelaySeconds: 1
timeoutSeconds: 1
name: tiller
ports:
- containerPort: 44134
name: tiller
- containerPort: 44135
name: http
# 健康检查
readinessProbe:
httpGet:
path: /readiness
port: 44135
initialDelaySeconds: 1
timeoutSeconds: 1
resources: {}
status: {}
3.2、执行
kubectl apply -f /root/helm/tiller.yaml
# 查看
kubectl get svc -n kube-system
kubectl get pods -n kube-system
3.3、查看helm服务
通过上面几步helm服务端旧部属好了
helm version
更多推荐
已为社区贡献55条内容
所有评论(0)