Add the kustomize.io docsy template

This commit is contained in:
David Jacob
2022-03-06 12:29:12 +01:00
parent f67dd5bbbd
commit 1fcd66258f
120 changed files with 14127 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
---
title: "Concepts"
linkTitle: "Concepts"
weight: 3
description: >
What does your user need to understand about your project in order to use it - or potentially contribute to it?
---
Might be nice to have some of those pictures from

View File

@@ -0,0 +1,7 @@
---
title: "Bases"
linkTitle: "Bases"
weight: 20
description: >
What is a base?
---

View File

@@ -0,0 +1,7 @@
---
title: "Components"
linkTitle: "Components"
weight: 50
description: >
What is a component?
---

View File

@@ -0,0 +1,7 @@
---
title: "Functions"
linkTitle: "Functions"
weight: 60
description: >
What is a function?
---

View File

@@ -0,0 +1,7 @@
---
title: "Generators"
linkTitle: "Generators"
weight: 30
description: >
What is a generator?
---

View File

@@ -0,0 +1,7 @@
---
title: "Kustomize File"
linkTitle: "Kustomize File"
weight: 10
description: >
What is the kustomize file?
---

View File

@@ -0,0 +1,7 @@
---
title: "Transformers"
linkTitle: "Transformers"
weight: 40
description: >
What is a base?
---

View File

@@ -0,0 +1,7 @@
---
title: "Getting Started"
linkTitle: "Getting Started"
weight: 2
description: >
What does your user need to know to try your project?
---

View File

@@ -0,0 +1,66 @@
---
title: "Creating Your First Kustomization"
linkTitle: "Creating Your First Kustomization"
date: 2022-02-27
weight: 20
description: >
A simple project example to get you familiar with the concepts
---
We're going to use kustomize to deploy an nginx instance into our Kubernetes cluster.
## Creating the directory structure
Let's firt create a directory to store our kustomize project.
```bash
mkdir kustomize-nginx && cd kustomize-nginx
```
Create a `base` folder:
```bash
mkdir base
```
Inside this folder we will create two files:
* `kustomization.yaml` - the configuration file for kustomize
* `deployment.yaml` - the definition for our nginx deployment
`kustomization.yaml`
```bash
cat <<'EOF' >base/kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
metadata:
name: kustomize-nginx
resources:
- deployment.yaml
EOF
```
The file defines the `apiVersion`, the `kind` and the `resources` it manages.
`deployment.yaml`
```bash
cat <<'EOF' >base/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
labels:
app: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:latest
ports:
- containerPort: 80
EOF
```
TBC...

View File

@@ -0,0 +1,97 @@
---
title: "Install Kustomize"
linkTitle: "Install Kustomize"
date: 2022-02-27
weight: 10
description: >
Installing Kustomize
---
Kustomize can be installed in a variety of ways.
## Binaries
Binaries are available for Linux, MacOS and Windows, across a variety of architectures.
You can see the full list of releases here on the [Github releases page](https://github.com/kubernetes-sigs/kustomize/releases).
### Quick install
Get the latest build of Kustomize for your platform.
```bash
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
```
You can also pass optional `version` and `target_dir` arguments to the script:
```bash
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" 4.4.1 $HOME/bin | bash
```
❗**This script doesnt work for ARM architecture**. If you want to install ARM binaries, please refer to the [releases page](https://github.com/kubernetes-sigs/kustomize/releases).
## Packages
Kustomize is also available in some package repositories.
### Debian/Ubuntu
```bash
sudo apt-get install kustomize
```
### Arch
```bash
pacman -S kustomize
```
### Mac
[Homebrew](https://brew.sh/):
```bash
brew install kustomize
```
[MacPorts](https://www.macports.org/):
```bash
sudo port install kustomize
```
### Windows
[Chocolatey](https://community.chocolatey.org/packages/kustomize)
```bash
choco install kustomize
```
## Docker
Docker images for kustomize are published on the [GCR Container Registry](https://console.cloud.google.com/gcr/images/k8s-artifacts-prod/US/kustomize/kustomize).
```bash
docker run k8s.gcr.io/kustomize/kustomize:v4.5.1 version
```
## go get
<!--
TODO: is this still the way to do this? v3 seems old and my go module knowledge isn't great
-->
Requires [Go](https://go.dev/) to be installed.
```bash
GOBIN=$(pwd)/ GO111MODULE=on go get sigs.k8s.io/kustomize/kustomize/v3
```
## Source
<!--
TODO: once again here, are these instructions up-to-date? We probably should bump to a later version of kustomize but I'm also not sure if these go env variables are modern practice
-->
Clone the kustomize Github repo and build using go.
```bash
# Need go 1.13 or higher
unset GOPATH
# see https://golang.org/doc/go1.13#modules
unset GO111MODULES
# clone the repo
git clone git@github.com:kubernetes-sigs/kustomize.git
# get into the repo root
cd kustomize
# Optionally checkout a particular tag if you don't
# want to build at head
git checkout kustomize/v3.2.3
# build the binary
(cd kustomize; go install .)
# run it
~/go/bin/kustomize version

View File

@@ -0,0 +1,113 @@
---
title: "Overview"
linkTitle: "Overview"
weight: 1
description: >
Introduction to Kustomize.
---
Kustomize provides a solution for customizing Kubernetes resource configuration free from templates and DSLs.
Kustomize lets you customize raw, template-free YAML files for multiple purposes, leaving the original YAML untouched and usable as is.
Kustomize targets kubernetes; it understands and can patch kubernetes style API objects. Its like make, in that what it does is declared in a file, and its like sed, in that it emits edited text.
## Usage
### 1) Make a `kustomization` file
In some directory containing your YAML `resource`
files (deployments, services, configmaps, etc.), create a
`kustomization` file.
This file should declare those resources, and any
customization to apply to them, e.g. _add a common
label_.
File structure:
```
~/someApp
├── deployment.yaml
├── kustomization.yaml
└── service.yaml
```
The resources in this directory could be a fork of
someone else's configuration. If so, you can easily
rebase from the source material to capture
improvements, because you don't modify the resources
directly.
Generate customized YAML with:
```
kustomize build ~/someApp
```
The YAML can be directly `applied` to a cluster:
```
kustomize build ~/someApp | kubectl apply -f -
```
### 2) Create `variants` using `overlays`
Manage traditional `variants` of a configuration - like
_development_, _staging_ and _production_ - using
`overlays` that modify a common `base`.
File structure:
```
~/someApp
├── base
│ ├── deployment.yaml
│ ├── kustomization.yaml
│ └── service.yaml
└── overlays
├── development
│ ├── cpu_count.yaml
│ ├── kustomization.yaml
│ └── replica_count.yaml
└── production
├── cpu_count.yaml
├── kustomization.yaml
└── replica_count.yaml
```
Take the work from step (1) above, move it into a
`someApp` subdirectory called `base`, then
place overlays in a sibling directory.
An overlay is just another kustomization, referring to
the base, and referring to patches to apply to that
base.
This arrangement makes it easy to manage your
configuration with `git`. The base could have files
from an upstream repository managed by someone else.
The overlays could be in a repository you own.
Arranging the repo clones as siblings on disk avoids
the need for git submodules (though that works fine, if
you are a submodule fan).
Generate YAML with
```sh
kustomize build ~/someApp/overlays/production
```
The YAML can be directly `applied` to a cluster:
```sh
kustomize build ~/someApp/overlays/production | kubectl apply -f -
```
## Where should I go next?
Give your users next steps from the Overview. For example:
* [Getting Started](/docs/getting-started/): Get started with $project
* [Examples](/docs/examples/): Check out some example code!

View File

@@ -0,0 +1,14 @@
---
title: "Reference"
linkTitle: "Reference"
weight: 9
description: >
Low level reference docs for your project.
---
{{% pageinfo %}}
This is a placeholder page that shows you how to use this template site.
{{% /pageinfo %}}
If your project has an API, configuration, or other reference - anything that users need to look up thats at an even lower level than a single task - put (or link to it) here. You can serve and link to generated reference docs created using Doxygen,
Javadoc, or other doc generation tools by putting them in your `static/` directory. Find out more in [Adding static content](https://docsy.dev/docs/adding-content/content/#adding-static-content). For OpenAPI reference, Docsy also provides a [Swagger UI layout and shortcode](https://www.docsy.dev/docs/adding-content/shortcodes/#swaggerui) that renders [Swagger UI](https://swagger.io/tools/swagger-ui/) using any OpenAPI YAML or JSON file as source.

View File

@@ -0,0 +1,8 @@
---
title: "Glossary"
linkTitle: "Glossary"
weight: 3
date: 2017-01-05
description: >
Definitions of the terminology used when interacting with kustomize
---

View File

@@ -0,0 +1,8 @@
---
title: "kustomize CLI"
linkTitle: "kustomize CLI"
weight: 2
date: 2017-01-05
description: >
Reference for the kustomize CLI
---

View File

@@ -0,0 +1,8 @@
---
title: "kustomize.yaml"
linkTitle: "kustomize.yaml"
weight: 1
date: 2017-01-05
description: >
Reference for the kustomize.yaml file
---

View File

@@ -0,0 +1,25 @@
---
title: "Core Tasks"
linkTitle: "Core Tasks"
weight: 4
date: 2017-01-05
description: >
What can your user do with your project?
---
{{% pageinfo %}}
This is a placeholder page that shows you how to use this template site.
{{% /pageinfo %}}
Think about your projects features and use cases. Use these to choose your core tasks. Each granular use case (enable x, configure y) should have a corresponding tasks page or tasks page section. Users should be able to quickly refer to your core tasks when they need to find out how to do one specific thing, rather than having to look for the instructions in a bigger tutorial or example. Think of your tasks pages as a cookbook with different procedures your users can combine to create something more substantial.
You can give each task a page, or you can group related tasks together in a page, such as tasks related to a particular feature. As well as grouping related tasks in single pages, you can also group task pages in nested folders with an index page as an overview, as seen in this example site. Or if you have a small docset like the [Docsy User Guide](https://docsy.dev/docs/) with no Tutorials or Concepts pages, consider adding your feature-specific pages at the top level of your docs rather than in a Tasks section.
Each task should give the user
* The prerequisites for this task, if any (this can be specified at the top of a multi-task page if they're the same for all the page's tasks. "All these tasks assume that you understand....and that you have already....").
* What this task accomplishes.
* Instructions for the task. If it involves editing a file, running a command, or writing code, provide code-formatted example snippets to show the user what to do! If there are multiple steps, provide them as a numbered list.
* If appropriate, links to related concept, tutorial, or example pages.

View File

@@ -0,0 +1,8 @@
---
title: "ConfigMaps and Secrets"
linkTitle: "ConfigMaps and Secrets"
weight: 3
date: 2017-01-05
description: >
Working with ConfigMaps and Secrets
---

View File

@@ -0,0 +1,8 @@
---
title: "Labels and Annotations"
linkTitle: "Labels and Annotations"
weight: 2
date: 2017-01-05
description: >
Working with Labels and Annotations
---

View File

@@ -0,0 +1,8 @@
---
title: "Namespaces and Names"
linkTitle: "Namespaces and Names"
weight: 1
date: 2017-01-05
description: >
Working with Namespaces and Names
---

View File

@@ -0,0 +1,16 @@
---
title: "Tutorials"
linkTitle: "Tutorials"
weight: 6
date: 2017-01-04
description: >
Show your user how to work through some end to end examples.
---
{{% pageinfo %}}
This is a placeholder page that shows you how to use this template site.
{{% /pageinfo %}}
Tutorials are **complete worked examples** made up of **multiple tasks** that guide the user through a relatively simple but realistic scenario: building an application that uses some of your projects features, for example. If you have already created some Examples for your project you can base Tutorials on them. This section is **optional**. However, remember that although you may not need this section at first, having tutorials can be useful to help your users engage with your example code, especially if there are aspects that need more explanation than you can easily provide in code comments.

View File

@@ -0,0 +1,8 @@
---
title: "Deploying a Custom Application"
linkTitle: "Deploying a Custom Application"
weight: 1
date: 2017-01-05
description: >
How to use Kustomize to deploy an in-house application
---

View File

@@ -0,0 +1,8 @@
---
title: "Deploying an Off-The-Shelf Application"
linkTitle: "Deploying an Off-The-Shelf Application"
weight: 1
date: 2017-01-05
description: >
How to use Kustomize to deploy a third-party application
---

23
site/content/en/docs/_index.md Executable file
View File

@@ -0,0 +1,23 @@
---
title: "Documentation"
linkTitle: "Documentation"
menu:
main:
weight: 10
---
{{% pageinfo %}}
This is a placeholder page that shows you how to use this template site.
{{% /pageinfo %}}
This section is where the user documentation for your project lives - all the information your users need to understand and successfully use your project.
For large documentation sets we recommend adding content under the headings in this section, though if some or all of them dont apply to your project feel free to remove them or add your own. You can see an example of a smaller Docsy documentation site in the [Docsy User Guide](https://docsy.dev/docs/), which lives in the [Docsy theme repo](https://github.com/google/docsy/tree/master/userguide) if you'd like to copy its docs section.
Other content such as marketing material, case studies, and community updates should live in the [About](/about/) and [Community](/community/) pages.
Find out how to use the Docsy theme in the [Docsy User Guide](https://docsy.dev/docs/). You can learn more about how to organize your documentation (and how we organized this site) in [Organizing Your Content](https://docsy.dev/docs/best-practices/organizing-content/).