Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to deploy and experience Helm

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the knowledge of "how to deploy and experience Helm". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

About Helm

Container deployment on Kubernetes is not easy. Docker, environment variables, storage, network and other aspects will be involved. These complex operations can be implemented by Helm application package management tools, avoiding all manual operations. Helm official website: https://helm.sh

Actual combat environment

The actual combat environment is kubernetes cluster (version 1.15.3), which is composed of three CentOS7.7 servers.

After deployment, in the process of experiencing Helm, you need to prepare NFS in advance as the network storage space for deploying applications.

Deploy the client

Ssh logs in to a server that can perform kubectl operations:

Download the helm package at https://get.helm.sh/helm-v2.16.1-linux-amd64.tar.gz

Decompress:

Tar-zxvf helm-v2.16.1-linux-amd64.tar.gz

Put the helm files in the extracted folder into / usr/local/bin/:

Mv linux-amd64/helm / usr/local/bin/

Looking at the helm version, as shown below, you can see that the client version is 2.16.1. Since the helm server (named tiller) has not been deployed yet, "could not find tiller" is displayed:

[root@node1 ~] # helm versionClient: & version.Version {SemVer: "v2.16.1", GitCommit: "bbdfe5e7803a12bbdf97e94cd847859890cf4050", GitTreeState: "clean"} Error: could not find tiller

After the client is deployed, the next step is to set up the ServiceAccount and role binding.

Bind the account to the role

Create a ServiceAccount named tiller:

Kubectl create serviceaccount-namespace kube-system tiller

Bind the tiller to the role tiller-cluster-rule:

Kubectl create clusterrolebinding tiller-cluster-rule-clusterrole=cluster-admin-serviceaccount=kube-system:tiller

Helm initialization, where the image of tiller is from Aliyun, and the default repository is also set to Aliyun:

Helm init-- upgrade-I registry.cn-hangzhou.aliyuncs.com/google_containers/tiller:v2.16.1-- stable-repo-url https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts-- service-account tiller

Wait for the console prompt to be successful and execute helm version again. The output is as follows. It can be seen that the server of helm has returned information:

[root@node1 ~] # helm versionClient: & version.Version {SemVer: "v2.16.1", GitCommit: "bbdfe5e7803a12bbdf97e94cd847859890cf4050", GitTreeState: "clean"} Server: & version.Version {SemVer: "v2.16.1", GitCommit: "bbdfe5e7803a12bbdf97e94cd847859890cf4050", GitTreeState: "clean"}

Now that helm is installed, let's deploy an application to try

Prepare NFS

Storage volumes will be used next when deploying the service with helm, so prepare PV in advance

I'm ready here for NFS as PV.

Note that the NFS client should be installed on all hosts in the K8S cluster. The installation command for CentOS is as follows:

Yum install nfs-utils-y

Create a file called pv-tomcat.yaml with the following contents, where 192.168.133.142 is the address of the NFS server and / usr/local/work/test/001 is the available storage path:

ApiVersion: v1kind: PersistentVolumemetadata: name: pv-tomcat namespace: defaultspec: capacity: storage: 10Gi accessModes:-ReadWriteOnce persistentVolumeReclaimPolicy: Recycle nfs: path: / usr/local/work/test/001 server: 192.168.133.142

Execute the following command to create the PV:

Kubectl create-f pv-tomcat.yaml

PV is ready to deploy applications through Helm

Experience

Want to deploy tomcat, execute the command helm search tomcat search, but found that Aliyun's helm warehouse is not available, can only be found in other warehouses

Add a warehouse:

Helm repo add bitnami https://charts.bitnami.com/bitnami

Look for tomcat again, and this time you have:

[root@node1 ~] # helm search tomcatNAME CHART VERSION APP VERSION DESCRIPTION bitnami/tomcat 6.0.6 9.0.29 Chart for Apache Tomcat

Execute the following command to deploy tomcat, specifying the chat name as my-tomcat:

Helm install\-name my-tomcat\ bitnami/tomcat

Use the helm list command to view:

[root@node1 ~] # helm listNAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACEmy-tomcat 1 Sun Nov 24 20:29:16 2019 DEPLOYED tomcat-6.0.6 9.0.29 default

Using the kubectl get services command to view the kubernetes service, you can see that a service has been created for tomcat, and the type is LoadBalancer:

[root@node1 local] # kubectl get servicesNAME TYPE CLUSTER-IP EXTERNAL-IP PORT (S) AGEkubernetes ClusterIP 10.233.0.1 443/TCP 3h46mmy-tomcat LoadBalancer 10.233.16.166 80:31229/TCP 100s

As can be seen from the above information, the tomcat service type is LoadBalancer, so we can access it through port 31229 of the host, as shown in the following figure:

This is the end of how to deploy and experience Helm. Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report