helm

Helm is a tool to manage yaml files. it can create templeate yaml files, and the value.yaml; the vaules in value.yaml will replace templeate setup, so it can deploy user defined app. 

The Chart File Structure

A chart is organized as a collection of files inside of a directory. The directory name is the name of the chart (without versioning information). Thus, a chart describing WordPress would be stored in a wordpress/ directory.

Inside of this directory, Helm will expect a structure that matches this:

wordpress/
  Chart.yaml          # A YAML file containing information about the chart     -- To define the name of Chart 
  LICENSE             # OPTIONAL: A plain text file containing the license for the chart
  README.md           # OPTIONAL: A human-readable README file  
  values.yaml         # The default configuration values for this chart   -- repalce it with your example.yaml in where you define the key and value paris you want to replace 
  values.schema.json  # OPTIONAL: A JSON Schema for imposing a structure on the values.yaml file
  charts/             # A directory containing any charts upon which this chart depends.    -- nest chart  
  crds/               # Custom Resource Definitions
  templates/          # A directory of templates that, when combined with values,     -- templete, which can generated based on your exsiting yaml 
                      # will generate valid Kubernetes manifest files.
  templates/NOTES.txt # OPTIONAL: A plain text file containing short usage notes


Example Configure Map Templemt
apiVersion: apps/v1
kind: Deployment
metadata:
  name: "{{ .Values.name }}"
  labels:
    app: "{{ .Values.name }}"
spec:
  selector:
    matchLabels:
      app: "{{ .Values.name }}"
  replicas: 2
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
  template:
    metadata:
      annotations:
        checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
      labels:
        app: "{{ .Values.name }}"
    spec:
      containers:
      - name: "{{ .Values.name }}"
        image: {{ .Values.deployment.image }}:{{ .Values.deployment.tag }}
        imagePullPolicy: Always
        ports:
        - containerPort: 5000

 

Exampple app.yaml

$ cat example-app-01.values.yaml
deployment:
image: "aimvector/python"
tag: "1.0.4"
name: example-app%

 
posted @ 2021-03-07 06:27  anyu686  阅读(59)  评论(0编辑  收藏  举报