Kubernetes choreography artifact Helm

What is Kubernetes Helm? Why use the Helm?

Foreword

Kubernetes write a bunch of configuration files is a very troublesome thing. For some vessels, we may need more than 10 yaml files. Maintaining them is a problem, and run the file using the same or in a different environment is a nightmare.
We can use some bash tricks to replace some value, but this is a bad practice.
This is why we want to use the helm.
I should mention that there is another good tool ksonnet, its own way, "the same" operation.
In this article, I'll describe why the Helm is Kubernetes an essential element of the application, the application will Kubernetes Helm and packaging process, as well as how to use some complex applications Helm deployment may have.

Why use helm

I recently microService very complex deployments, my publisher files in the directory has more than 65 Kubernetes O configuration file ... ( ^ ▽ ^ ) ┛).
The main question is, how do I put this service to deploy multiple environments?
Or how to make use Kubernetes CI / CD?
Of course, to do some shell script is a choice, but I do not like to do so.
Then, I started using Kubernetes research CI / CD pipline, Helm will find some teams are integrated into the process.

We can be understood as a package for the application as an application like that, where we can rely on management, different types of hook (pre-installed, pre-upgrade, installation, etc.), and can be easily upgraded or rolled back.

installation

  • Select the version you want to install a https://github.com/helm/helm/releases
  • Decompression tar -zxvf helm-v3.0.0-linux-amd64.tar.gz
  • Unzip directory to find the binary file, move it to your system variables such as directory mv linux-amd64/helm /usr/local/bin/helm
[root@localhost helm-test]# helm init
Creating /root/.helm
Creating /root/.helm/repository
Creating /root/.helm/repository/cache
Creating /root/.helm/repository/local
Creating /root/.helm/plugins
Creating /root/.helm/starters
Creating /root/.helm/cache/archive
Creating /root/.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 /root/.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.
To prevent this, run `helm init` with the --tiller-tls-verify flag.
For more information on securing your installation see: https://docs.helm.sh/using_helm/#securing-your-helm-installation
[root@localhost helm-test]#

pods in view kubernetes kube-system of the namespace

[root@localhost test-app]# kubectl get pods --namespace=kube-system
NAME                                            READY   STATUS             RESTARTS   AGE
coredns-58cc8c89f4-q7lgg                        1/1     Running            4          40d
coredns-58cc8c89f4-wdqqx                        1/1     Running            4          40d
etcd-localhost.localdomain                      1/1     Running            4          40d
kube-apiserver-localhost.localdomain            1/1     Running            4          40d
kube-controller-manager-localhost.localdomain   1/1     Running            4          40d
kube-proxy-gt72b                                1/1     Running            4          40d
kube-scheduler-localhost.localdomain            1/1     Running            4          40d
tiller-deploy-58f57c5787-t2b7w                  0/1     ImagePullBackOff   0          22m
weave-net-qdr2l                                 2/2     Running            8          40d
[root@localhost test-app]#

Will find tiller-deploy-*is starting.

Create a sample

[root@localhost helm-test]# helm create test-app
Creating test-app
  • Once created the directory structure is as follows
[root@localhost helm-test]# tree test-app/
test-app/
├── charts
├── Chart.yaml
├── templates
│   ├── deployment.yaml
│   ├── _helpers.tpl
│   ├── ingress.yaml
│   ├── NOTES.txt
│   ├── serviceaccount.yaml
│   ├── service.yaml
│   └── tests
│       └── test-connection.yaml
└── values.yaml

3 directories, 9 files
[root@localhost helm-test]#
  • Chart.yaml: This is the main file description of the chart
  • values.yaml: This is the file that contains the default values ​​chart
  • templates: This is defined as a template Kubernetes resource directory
  • charts: This is an optional directory, it may contain sub-graph
Key%%

Just as we have seen, all the templates folder Kubernetes profiles are templates.
You can use the Chart.yamlfile to describe the current project, and it can be versioned.
We just need a file, used to configure the application, and values.yamlall values are stored.

Run:

⚡ helm install --name test test-app/

So our first demo helm of implementation success.

Also, the following error, on behalf of pod tiller-deploy-*is not started successfully:

Error: could not find a ready tiller pod

For details refer to the official documentation https://helm.sh/docs/

Guess you like

Origin www.cnblogs.com/jasondayee/p/12091046.html