wordpress/ Chart.yaml # A YAML file containing information about the chart LICENSE# OPTIONAL: A plain text file containing the license for the chart README.md # OPTIONAL: A human-readable README file requirements.yaml # OPTIONAL: A YAML file listing dependencies for the chart values.yaml # The default configuration values for this chart charts/ # OPTIONAL: A directory containing any charts upon which this chart depends. templates/ # OPTIONAL: A directory of templates that, when combined with values, # will generate valid Kubernetes manifest files. templates/NOTES.txt # OPTIONAL: A plain text file containing short usage notes
name:Thenameofthechart(required) version:ASemVer2version(required) description:Asingle-sentencedescriptionofthisproject(optional) keywords: -Alistofkeywordsaboutthisproject(optional) home:TheURLofthisproject'shomepage(optional) sources: -AlistofURLstosourcecodeforthisproject(optional) maintainers:# (optional) -name:Themaintainer'sname(requiredforeachmaintainer) email:Themaintainer'semail(optionalforeachmaintainer) url:AURLforthemaintainer(optionalforeachmaintainer) engine:gotpl# The name of the template engine (optional, defaults to gotpl) icon:AURLtoanSVGorPNGimagetobeusedasanicon(optional). appVersion:Theversionoftheappthatthiscontains(optional).Thisneedn'tbeSemVer. deprecated:Whetherornotthischartisdeprecated(optional,boolean) tillerVersion: The version of Tiller that this chart requires. This should be expressed as a SemVer range:">2.0.0"(optional)
MySQL can be accessed via port 3306 on the following DNS name from within your cluster: {{ template "mysql.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local
3. Connect using the mysql cli, then provide your password: $ mysql -h {{ template "mysql.fullname" . }} -p
To connect to your database directly from outside the K8s cluster: {{- if contains "NodePort" .Values.service.type }} MYSQL_HOST=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath='{.items[0].status.addresses[0].address}') MYSQL_PORT=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "mysql.fullname" . }} -o jsonpath='{.spec.ports[0].nodePort}')
Helm charts store their dependencies in 'charts/'. For chart developers, it is often easier to manage a single dependency file ('requirements.yaml') which declares all dependencies.
The dependency commands operate on that file, making it easy to synchronize between the desired dependencies and the actual dependencies stored in the 'charts/' directory.
A 'requirements.yaml' file is a YAML file in which developers can declare chart dependencies, along with the location of the chart and the desired version. For example, this requirements file declares two dependencies:
The 'name' should be the name of a chart, where that name must match the name in that chart's 'Chart.yaml' file.
The 'version' field should contain a semantic version or version range.
The 'repository' URL should point to a Chart Repository. Helm expects that by appending '/index.yaml' to the URL, it should be able to retrieve the chart repository's index. Note: 'repository' can be an alias. The alias must start with 'alias:' or '@'.
Starting from 2.2.0, repository can be defined as the path to the directory of the dependency charts stored locally. The path should start with a prefix of "file://". For example,
If the dependency chart is retrieved locally, it is not required to have the repository added to helm by "helm add repo". Version matching is also supported for this case.
Usage: helm dependency [command]
Aliases: dependency, dep, dependencies
Available Commands: build rebuild the charts/ directory based on the requirements.lock file list list the dependencies for the given chart update update charts/ based on the contents of requirements.yaml
Flags: -h, --help help for dependency
Use "helm dependency [command] --help" for more information about a command.
$ helm package --help This command packages a chart into a versioned chart archive file. If a path is given, this will look at that path for a chart (which must contain a Chart.yaml file) and then package that directory.
If no path is given, this will look in the present working directory for a Chart.yaml file, and (if found) build the current directory into a chart.
Versioned chart archives are used by Helm package repositories.
Usage: helm package [flags] [CHART_PATH] [...]
Flags: -u, --dependency-update update dependencies from "requirements.yaml" to dir "charts/" before packaging -d, --destination string location to write the chart. (default ".") --key string name of the key to use when signing. Used if --sign is true --keyring string location of a public keyring (default "/Users/daniel/.gnupg/pubring.gpg") --save save packaged chart to local chart repository (default true) --sign use a PGP private key to sign this package --version string set the version on the chart to this semver version
我们还是用刚才的myweb作为例子:
1 2
$ helm package myweb Successfully packaged chart and saved it to: /Users/daniel/Works/k8s/helm/myweb-0.1.0.tgz
$ helm template --help Render chart templates locally and display the output.
This does not require Tiller. However, any values that would normally be looked up or retrieved in-cluster will be faked locally. Additionally, none of the server-side testing of chart validity (e.g. whether an API is supported) is done.
To render just one template in a chart, use '-x': $ helm template mychart -x templates/deployment.yaml
Usage: helm template [flags] CHART
Flags: -x, --execute stringArray only execute the given templates --kube-version string override the Kubernetes version used as Capabilities.KubeVersion.Major/Minor (e.g. 1.7) -n, --name string release name (default "RELEASE-NAME") --name-template string specify template used to name the release --namespace string namespace to install the release into --notes show the computed NOTES.txt file as well --set stringArray set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) -f, --values valueFiles specify values in a YAML file (can specify multiple) (default [])