[Cloud native k8s] Helm tool installation

Hits: 0

Table of contents

1. Overview of Helm

1. Introduction to helm

2. helm architecture

3. Important concepts of helm

4. helm components

4.1 helm client

4.2 Tiller Server

2. Deploy Helm

1. Install the helm client

2. Install Tiller server (you need to create an authorized user)

3. Configure the helm warehouse

4. Test whether helm can be used normally

1. Overview of Helm

1. Introduction to helm

Deploying container cloud applications in [Kubernetes] is also a challenging task. Helm is a client tool to simplify the installation and deployment of container cloud applications in Kubernetes . Using helm can help developers define, install and upgrade container cloud applications in Kubernetes, and can also share container cloud applications through helm. Common applications including Redis, MySQL, and Jenkins are provided in Kubeapps Hub, which can be deployed and installed in your own Kubernetes cluster with one command through helm .

Helm is a tool for managing Kubernetes packages. Helm can provide the following capabilities:

  1. Create new charts (charts)
  2. Package charts into tgz files
  3. Interact with the chart repository
  4. Install and uninstall Kubernetes applications
  5. Manage the lifecycle of charts installed with Helm

2. helm architecture

The Helm architecture consists of the Helm client, the Tiller server, and the Chart repository; Tiller is deployed in Kubernetes, and the Helm client obtains the Chart installation package from the Chart repository, and installs and deploys it to the Kubernetes cluster.

3. Important concepts of helm

  1. Charts : It is a collection of information for creating Kubernetes application instances, that is, a helm package. It contains all the images, dependencies and resource definitions required to run a k8s application, and also contains Service resource definitions if necessary. It is similar to yum rpm file
  2. Repository : Chart repository for centralized storage and distribution of Charts.
  3. Config : The configuration information used when the application is instantiated and installed
  4. Release : a running instance of the chart, including a specific config

4. helm components

4.1 helm client

The client is responsible for the following tasks:

  • Local chart development
  • Manage warehouse
  • Interact with the Tiller server (send charts to be installed, request information about releases, request updates or uninstall installed releases)

4.2 Tiller Server

Tiller is the server side of helm , which generally runs on the kubernetes cluster, defines the ServiceAccount of tiller, and binds it to the cluster administrator role cluster-admin through ClusterRoleBinding, so that it has all the highest privileges at the cluster level

The Tiller server is responsible for the following tasks:

  1. Listen for requests from the Helm client
  2. Combining charts and configurations to build a release
  3. Install in Kubernetes and track subsequent releases
  4. By interacting with Kubernetes, update or chart

2. Deploy Helm

1. Install the helm client

#wget https://get.helm.sh/helm-v2.14.3-linux-amd64.tar.gz
[root@master ~]# wget http://101.34.22.188/k8s/helm-v2.14.3-linux-amd64.tar.gz
[root@master ~]# tar zxvf helm-v2.14.3-linux-amd64.tar.gz    
[root@master ~]# mv linux-amd64/helm /usr/local/bin/
[root@master ~]# chmod +x /usr/local/bin/helm 
[root@master ~]# echo 'source <(helm completion bash)' >> /etc/profile
[root@master ~]# . /etc/profile

2. Install Tiller server (you need to create an authorized user)

[root@master ~]# vim tiller-rbac.yaml   
apiVersion: v1
kind: ServiceAccount
metadata:
  name: tiller
  namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
  name: tiller
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
subjects:
  - kind: ServiceAccount
    name: tiller
    namespace: kube-system

[ root@master ~ ] # kubectl apply -f tiller-rbac.yaml 
[ root@master ~ ] # helm init --service-account=tiller 
[ root@master ~ ] # kubectl get pod -n kube-system | grep tiller 
[ root@master ~ ] # kubectl edit pod tiller-deploy-8557598fbc-tvfsj -n kube-system 
//Edit the pod's yaml file and change the image used by it to the domestic Alibaba Cloud. The default is Google's image, and the download is not available. Down 
//Modify the image specified in the spec field as follows: 
    image: gcr.io/kubernetes-helm/tiller:v2 .14 .3 
//Modify as follows: 
    image: registry.cn-hangzhou.aliyuncs.com/google_containers/tiller : v2.14.3 _
//After modification, save and exit, it will automatically download the new image (if there is no automatic download, think of a way, for example, manually download the image on the node where the tiller container is located, and then restart the kubelet of the node, or restart The container) 
[ root@master ~ ] # kubectl get pod -n kube-system | grep tiller 
//As long as the tiller pod is running normally 
tiller-deploy -8557598f bc-m986t    1 / 1      Running    0           7 m54s

3. Configure the helm warehouse

[root@master ~] # helm repo list       //View its warehouse information
NAME    URL                                             
stable https: //kubernetes-charts.storage.googleapis.com 
//As above, the default is Google, in foreign countries, the speed is very slow 
local http: //127.0.0.1:8879/charts     
//Execute the following command to change to domestic Ali Cloud's warehouse 
[root@master ~] # helm repo add stable https: //kubernetes.oss-cn-hangzhou.aliyuncs.com/charts 
[root@master ~] # helm repo list       //Check again, you can find that the changes take effect span
NAME    URL                                                   
stable https: //kubernetes.oss-cn-hangzhou.aliyuncs.com/charts 
local http: //127.0.0.1:8879/charts         
[root@master ~] # helm repo update     //Update the helm repository 
[root@master ~] # helm version         //To view the helm version information, you must ensure that the client and server can be viewed before you can use helm 
Client: &version.Version{SemVer: "v2.14.3" , GitCommit: "0e7f3b6637f7af8fcfddb3d2941fcc7cbebb0085" , GitTreeState: "clean " }
Server: &version.Version{SemVer:"v2.14.3", GitCommit:"0e7f3b6637f7af8fcfddb3d2941fcc7cbebb0085", GitTreeState:"clean"}

4. Test whether helm can be used normally

[root@master ~] # helm search mysql       //Search MySQL
 //The charts package file is viewed, and the version found is the version of helm's Charts package 
[root@master ~] # helm inspect stable/mysql     //View Its details 
[root@master ~] # helm fetch stable/mysql       //Download the searched package to the local 
[root@master templates] # helm install stable/mysql      //Install this MySQL online

Leave a Reply

Your email address will not be published.