手记

在Kubernetes集群中安装Helm

此文章只包含简单的信息记录, 不包含原理说明和详细的过程描述.

安装Kubernetes

测试环境使用kubeadm安装kubernetes v1.6.3版本, 安装过程略过.

为Helm创建客户端认证

客户端认证是为了能够使用helm命令行调用Helm的服务端Tiller.

cd /etc/kubernetes/pki/# 编译认证文件openssl genrsa -out helm.key 2048openssl req -new -key helm.key -subj "/CN=helm" -out helm.csr
openssl x509 -req -in helm.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out helm.crt -days 10000openssl x509  -noout -text -in ./helm.crt# 创建Helm contextkubectl config set-context helm@kubernetes --cluster=kubernetes --namespace=monitoring --user=helm# 设置helm用户的客户端认证kubectl config set-credentials helm --client-certificate=helm.crt --client-key=helm.key --embed-certs=true# 切换至helm contextkubectl config use-context helm@kubernetes

为Helm设置服务端RBAC授权

服务端RBAC授权是为了让Tiller有权限在其他namesapce中创建资源.

# 切换至admin contextkubectl config use-context kubernetes-admin@kubernetes# 创建helm使用的serviceaccountkubectl create serviceaccount helm --namespace=kube-system# 创建角色绑定kubectl create clusterrolebinding helm-sa-admin --clusterrole=admin --serviceaccount=kube-system:helm --namespace=kube-system

安装Helm

# 切换至helm contextkubectl config use-context helm@kubernetes# 安装helm, 使用授权好的serviceaccounthelm init --service-account=helm

使用helm安装prometheus

kubectl create namespace monitoring
helm install stable/prometheus --name=prometheu
helm status prometheus



作者:__左弈__
链接:https://www.jianshu.com/p/XZ5PWC


0人推荐
随时随地看视频
慕课网APP