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 use Kubernetes Helm

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "how to use Kubernetes Helm". Friends who are interested might as well take a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn how to use Kubernetes Helm.

What is Helm? This is not the name of the Diablo gear: helmet, but a package management tool for Kubernetes to simplify the deployment and management of Kubernetes applications. The relationship between Helm and Kubernetes can be understood as the relationship between yum and CentOS,apt-get and Ubuntu.

Helm consists of two parts, client-side helm and server-side tiller.

Tiller runs on the Kubernetes cluster and manages chart, while the client helm is a command-line tool that runs locally and generally runs on continuous integration / continuous delivery servers.

The following figure is an architectural diagram of helm.

Let's try helm now.

Install the helm client first.

Download the archive of the helm execution file:

Wget-O helm.tar.gz https://storage.googleapis.com/kubernetes-helm/helm-v2.11.0-linux-amd64.tar.gz tar-xzf helm.tar.gz

After unzipping, move the helm file to the directory / usr/local/bin/helm:

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

Add execution permissions to this file:

Chmod + x / usr/local/bin/helm

First, use the-namespace parameter to specify the namespace to use, and the namespace in my example is part-0110:

Helm init-tiller-namespace part-0110-service-account access

Helm init-tiller-namespace part-0110-service-account access

Creating / home/vagrant/.helm

Creating / home/vagrant/.helm/repository

Creating / home/vagrant/.helm/repository/cache

Creating / home/vagrant/.helm/repository/local

Creating / home/vagrant/.helm/plugins

Creating / home/vagrant/.helm/starters

Creating / home/vagrant/.helm/cache/archive

Creating / home/vagrant/.helm/repository/repositories.yaml

Adding stable repo with URL: https://kubernetes-charts.storage.googleapis.com

Adding local repo with URL: http://127.0.0.1:8879/charts

$HELM_HOME has been configured at / home/vagrant/.helm.

Tiller (the Helm server-side component) has been installed into your Kubernetes Cluster.

Please note: by default, Tiller is deployed with an insecure 'allow unauthenticated users' policy.

For more information on securing your installation see: https://docs.helm.sh/using_helm/#securing-your-helm-installation

Happy Helming!

From the output of the init command from helm, we can observe that this command generates a large number of repository necessary to interact with helm server.

You can now view the version numbers of the helm client and server using the helm version command line argument:

Helm version-tiller-connection-timeout=5-tiller-namespace part-0110

Vagrant@vagrant:~/.kube$ helm version-tiller-connection-timeout=5-tiller-namespace part-0110

Client: & version.Version {SemVer: "v2.9.1", GitCommit: "20adb27c7c5868466912eebdf6664e7390ebe710", GitTreeState: "clean"}

Server: & version.Version {SemVer: "v2.9.1", GitCommit: "20adb27c7c5868466912eebdf6664e7390ebe710", GitTreeState: "clean"}

Use the command helm repo list to view a list of helm repositories:

Search for helm chart by name:

Helm search chaoskube

Use the following command line to install chart. The parameter jerry on the command line can be changed to your desired name as needed.

Helm install-name jerry stable/chaoskube-set namespaces=part-0110-set rbac.serviceAccountName=access-tiller-namespace part-0110-debug

The following is the output of the helm install command for your reference:

Vagrant@vagrant:~/.kube$ helm install-name jerry stable/chaoskube-set namespaces=part-0110-set rbac.serviceAccountName=access-tiller-namespace part-0110-debug

[debug] Created tunnel using local port: '36408'

[debug] SERVER: "127.0.0.1 purl 36408"

[debug] Original chart version: ""

[debug] Fetched stable/chaoskube to / home/vagrant/.helm/cache/archive/chaoskube-0.10.0.tgz

[debug] CHART PATH: / home/vagrant/.helm/cache/archive/chaoskube-0.10.0.tgz

NAME: jerry

REVISION: 1

RELEASED: Thu Nov 15 16:37:19 2018

CHART: chaoskube-0.10.0

USER-SUPPLIED VALUES:

Namespaces: part-0110

Rbac:

ServiceAccountName: access

COMPUTED VALUES:

Affinity: {}

Annotations: null

Debug: false

DryRun: true

ExcludedDaysOfYear: null

ExcludedTimesOfDay: null

ExcludedWeekdays: null

Image: quay.io/linki/chaoskube

ImageTag: v0.10.0

Interval: 10m

Labels: null

MinimumAge: 0s

Name: chaoskube

Namespaces: part-0110

NodeSelector: {}

PriorityClassName: ""

Rbac:

Create: false

ServiceAccountName: access

Replicas: 1

Resources: {}

Timezone: UTC

Tolerations: []

HOOKS:

MANIFEST:

Source: chaoskube/templates/deployment.yaml

ApiVersion: apps/v1beta1

Kind: Deployment

Metadata:

Name: jerry-chaoskube

Labels:

App: chaoskube

Heritage: "Tiller"

Release: "jerry"

Chart: chaoskube-0.10.0

Spec:

Replicas: 1

Selector:

MatchLabels:

App: chaoskube

Release: jerry

Template:

Metadata:

Labels:

App: chaoskube

Heritage: "Tiller"

Release: "jerry"

Chart: chaoskube-0.10.0

Spec:

Containers:

Name: chaoskube

Image: quay.io/linki/chaoskube:v0.10.0

Args:

-- interval=10m

-- labels=

-- annotations=

-- namespaces=part-0110

-- excluded-weekdays=

-- excluded-times-of-day=

-- excluded-days-of-year=

-- timezone=UTC

-- minimum-age=0s

Resources:

{}

ServiceAccountName: "access"

LAST DEPLOYED: Thu Nov 15 16:37:19 2018

NAMESPACE: part-0110

STATUS: DEPLOYED

RESOURCES:

= = > v1beta1/Deployment

NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE

Jerry-chaoskube 1 1 1 0 2s

= > v1/Pod (related)

NAME READY STATUS RESTARTS AGE

Jerry-chaoskube-6689695476-kchtn 0/1 ContainerCreating 0 1s

NOTES:

Chaoskube is running and will kill arbitrary pods every 10m.

You can follow the logs to see what chaoskube does:

POD=$ (kubectl-n part-0110 get pods-lager releasing property jerrymurochaoskube'--output=jsonpath=' {.items [0] .metadata.name}')

Kubectl-n part-0110 logs-f $POD

You are running in dry-run mode. No pod is actually terminated.

Using the helm list command, you can now see the chart you just installed named jerry.

Helm list-tiller-namespace part-0110

Use the helm command to view the details of this chart (similar to kubectl describe pod XXX)

Helm status jerry-tiller-namespace part-0110

The figure above also shows that the automatically generated pod is named jerry-chaoskube-6689695476-kchtn, and you can view its running log with the kubectl log command:

Kubectl log jerry-chaoskube-6689695476-kchtn

At this point, I believe you have a deeper understanding of "how to use Kubernetes Helm". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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

Servers

Wechat

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

12
Report