Use helm to manage complex application kubernetes

1. Review the warehouse:

$ helm repo list
NAME            URL
stable          https://aliacs-app-catalog.oss-cn-hangzhou.aliyuncs.com/charts/
local           http://127.0.0.1:8879
incubator       https://aliacs-app-catalog.oss-cn-hangzhou.aliyuncs.com/charts-incubator/

Start local repository:

$ helm serve&
[1] 15148
Regenerating index. This may take a moment.
Now serving you on 127.0.0.1:8879

2. Create helm applications

helm create test-chart

Structured as follows:

├─test-chart
├── charts
├── Chart.yaml
├── templates
│   ├── deployment.yaml
│   ├── _helpers.tpl
│   ├── NOTES.txt
│   └── service.yaml
└── values.yaml

The following simple configuration change values.yaml

replicaCount: 1

image:
  repository: daemonza/test
  tag: latest
  pullPolicy: IfNotPresent


service:
  name: test
  type: ClusterIP
  internalport: 80
  externalPort: 80

resources:
  limits:
    cpu: 100m
    memory: 128Mi
  requests:
    cpu: 100m
    memory: 128Mi

Change Chart.yaml configuration is as follows

apiVersion: v1
appVersion: "1.0"
description: A Helm chart for Kubernetes
name: test-chart
version: 0.1.0

3. The packaged test-chart

$ helm package test-chart
Successfully packaged chart and saved it to: D:\zhuojian-projects\rubik-T\health-doc\详细设计\helm\test-chart-0.1.0.tgz

Packaged at the same time, it will generate a copy of tgz file to a local warehouse.

4. Package chart suit 2: test-chart2, test-chart3, and packaged.

$ helm search test
NAME                    CHART VERSION   APP VERSION     DESCRIPTION
local/test-chart        0.2.0           1.0             A Helm chart for Kubernetes
local/test-chart2       0.1.0           1.0             A Helm chart for Kubernetes
local/test-chart3       0.2.0           4.0             A Helm chart for Kubernetes

The dependency is assumed test-chart: 0.1.0 version of test-chart2, 0.2.0 version of the test-chart3, for a description of package dependencies, a file may be used requirements.yaml, as follows:

dependencies:
- name: test-chart2
  version: "0.1.0"
  repository: http://127.0.0.1:8879
- name: test-chart3
  version: "0.2.0"
  repository: http://127.0.0.1:8879

Following is a list chart

├─test- chart 
├── charts 
├── Chart.yaml 
├── templates 
│ ├── deployment.yaml 
│ ├── _helpers.tpl 
│ ├── NOTES.txt 
│ ├── requirements.yaml 
│ └─ ─ service.yaml 
└── values.yaml

Execute the following commands, the corresponding dependencies downloaded to the test-chart charts directory:

$ helm dep update test-chart
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "local" chart repository
...Successfully got an update from the "stable" chart repository
...Successfully got an update from the "incubator" chart repository
Update Complete.
Saving 2 charts
Downloading test-chart2 from repo http://127.0.0.1:8879
Downloading test-chart3 from repo http://127.0.0.1:8879
Deleting outdated charts

After execution, test-chart again to see the directory structure, you will find the dependencies have been downloaded:

├─test-chart
├── charts
│   ├── test-chart2-0.1.0.tgz
│   ├── test-chart3-0.2.0.tgz
├── Chart.yaml
├── templates
│   ├── deployment.yaml
│   ├── _helpers.tpl
│   ├── NOTES.txt
│   ├── requirements.yaml
│   └── service.yaml
└── values.yaml

The test-chart2-0.1.0.tgz decompress, you will find is a complete example of test-chart2.

You can then use the test-chart helm installation and deployment, thus, completes the management helm of kubernetes with complex dependencies of the application.

Guess you like

Origin www.cnblogs.com/miaoying/p/11271023.html