Commit 15571a5a authored by Matt Butcher's avatar Matt Butcher
Browse files

docs(examples): add nginx example chart

This adds an nginx chart that shows off more of the template system's
capabilities.
parent 0acbcdd5
main Release add-codeql dependabot/go_modules/github.com/docker/distribution-2.8.2incompatible dependabot/go_modules/github.com/lib/pq-1.10.9 dependabot/go_modules/github.com/rubenv/sql-migrate-1.4.0 dependabot/go_modules/golang.org/x/crypto-0.9.0 dependabot/go_modules/golang.org/x/term-0.8.0 dependabot/go_modules/k8s.io/klog/v2-2.100.1 dev-v2 feat-v3/event-emitter-lua kube-update-test release-2.0 release-2.1 release-2.10 release-2.11 release-2.12 release-2.13 release-2.14 release-2.15 release-2.16 release-2.17 release-2.2 release-2.3 release-2.4 release-2.5 release-2.6 release-2.7 release-2.8 release-2.9 release-3.0 release-3.1 release-3.10 release-3.11 release-3.12 release-3.2 release-3.3 release-3.4 release-3.5 release-3.6 release-3.6.1 release-3.6.2 release-3.7 release-3.8 release-3.9 release-v3.0.0-beta.4 v3.12.0 v3.12.0-rc.1 v3.12.0-dev.1 v3.11.3 v3.11.2 v3.11.1 v3.11.0 v3.11.0-rc.2 v3.11.0-rc.1 v3.10.3 v3.10.2 v3.10.1 v3.10.0 v3.10.0-rc.1 v3.9.4 v3.9.3 v3.9.2 v3.9.1 v3.9.0 v3.9.0-rc.1 v3.8.2 v3.8.1 v3.8.0 v3.8.0-rc.2 v3.8.0-rc.1 v3.7.2 v3.7.1 v3.7.0 v3.7.0-rc.3 v3.7.0-rc.2 v3.7.0-rc.1 v3.6.3 v3.6.2 v3.6.1 v3.6.0 v3.6.0-rc.1 v3.5.4 v3.5.3 v3.5.2 v3.5.1 v3.5.0 v3.5.0-rc.2 v3.5.0-rc.1 v3.4.2 v3.4.1 v3.4.0 v3.4.0-rc.1 v3.3.4 v3.3.3 v3.3.2 v3.3.1 v3.3.0 v3.3.0-rc.2 v3.3.0-rc.1 v3.2.4 v3.2.3 v3.2.2 v3.2.1 v3.2.0 v3.2.0-rc.1 v3.1.3 v3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.3 v2.0.0-alpha.2
No related merge requests found
Showing with 162 additions and 0 deletions
+162 -0
...@@ -2,3 +2,18 @@ ...@@ -2,3 +2,18 @@
This directory contains example charts to help you get started with This directory contains example charts to help you get started with
chart development. chart development.
## Alpine
The `alpine` chart is very simple, and is a good starting point.
It simply deploys a single pod running Alpine Linux.
## Nginx
The `nginx` chart shows how to compose several resources into one chart,
and it illustrates more complex template usage.
It deploys a `deployment` (which creates a `replica set`), a `config
map`, and a `service`. The replica set starts an nginx pod. The config
map stores the files that the nginx server can serve.
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
.git
name: nginx
description: A basic NGINX HTTP server
version: 0.1.0
keywords:
- http
- nginx
- www
- web
home: "https://github.com/kubernetes/helm"
sources:
- "https://hub.docker.com/_/nginx/"
maintainers:
- name: technosophos
email: mbutcher@deis.com
# nginx: An advanced example chart
This Helm chart provides examples of some of Helm's more powerful
features.
**This is not a production-grade chart. It is an example.**
The chart installs a simple nginx server according to the following
pattern:
- A `ConfigMap` is used to store the files the server will serve.
(`templates/configmap.yaml`)
- A `Deployment` is used to create a Replica Set of nginx pods.
(`templates/deployment.yaml`)
- A `Service` is used to create a gateway to the pods running in the
replica set (`templates/svc.yaml`)
The `values.yaml` exposes a few of the configuration options in the
charts, though there are some that are not exposed there (like
`.image`).
The `templates/_helpers.tpl` file contains helper templates. The leading
underscore (`_`) on the filename is semantic. It tells the template renderer
that this file does not contain a manifest. That file declares some
templates that are used elsewhere in the chart.
You can deploy this chart with `helm install docs/examples/nginx`. Or
you can see how this chart would render with `helm install --dry-run
--debug docs/examples/nginx`.
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{define "name"}}{{default "nginx" .nameOverride | trunc 24 }}{{end}}
{{/*
Create a default fully qualified app name.
We truncate at 24 chars because some Kubernetes name fields are limited to this
(by the DNS naming spec).
*/}}
{{define "fullname"}}{{.Release.Name}}-{{default "nginx" .nameOverride | trunc 24 }}{{end}}
# This is a simple example of using a config map to create a single page
# static site.
apiVersion: v1
kind: ConfigMap
metadata:
name: {{template "fullname" .}}
labels:
release: {{.Release.Name}}
app: {{template "fullname" .}}
data:
# When the config map is mounted as a volume, these will be created as
# files.
index.html: {{default "Hello" .index | squote}}
test.txt: test
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
# This uses a "fullname" template (see _helpers)
# Basing names on .Release.Name means that the same chart can be installed
# multiple times into the same namespace.
name: {{template "fullname" .}}
labels:
heritage: helm
# This makes it easy to search using kubectl
release: {{.Release.Name}}
# This makes it easy to audit chart usage.
chart: {{.Chart.Name}}-{{.Chart.Version}}
spec:
replicas: {{default 1 .replicaCount}}
template:
metadata:
labels:
app: {{template "fullname" .}}
release: {{.Release.Name}}
spec:
containers:
- name: {{template "fullname" .}}
# Making image configurable is not necessary. Making imageTag configurable
# is a nice option for the user. Especially in the strange cases like
# nginx where the base distro is determined by the tag. Using :latest
# is frowned upon, using :stable isn't that great either.
image: "{{default "nginx" .image}}:{{default "stable-alpine" .imageTag}}"
imagePullPolicy: {{default "IfNotPresent" .pullPolicy}}
ports:
- containerPort: 80
# This (and the volumes section below) mount the config map as a volume.
volumeMounts:
- mountPath: /usr/share/nginx/html
name: wwwdata-volume
volumes:
- name: wwwdata-volume
configMap:
name: {{template "fullname" .}}
# This is a service gateway to the replica set created by the deployment.
apiVersion: v1
kind: Service
metadata:
name: {{template "fullname" .}}
labels:
heritage: helm
release: {{.Release.Name}}
chart: {{.Chart.Name}}-{{.Chart.Version}}
spec:
ports:
- port: {{default 80 .httpPort}}
targetPort: 80
protocol: TCP
name: http
selector:
app: {{template "fullname" .}}
# Default values for nginx.
# This is a YAML-formatted file.
# Declare name/value pairs to be passed into your templates.
# See the list at https://hub.docker.com/r/library/nginx/tags/
imageTag: "1.11.0"
# The port (defined on the service) to access the HTTP server.
httpPort: 8888
# Number of nginx instances to run
replicaCount: 1
index: >-
<h1>Hello</h1>
<p>This is a test</p>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment