mirror of https://github.com/fluxcd/flux2.git
commit
ce80bd521a
@ -0,0 +1,22 @@
|
|||||||
|
name: Publish docs via GitHub Pages
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- docs*
|
||||||
|
- master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Deploy docs
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout master
|
||||||
|
uses: actions/checkout@v1
|
||||||
|
- name: Copy assets
|
||||||
|
run: |
|
||||||
|
cp install/tk.sh docs/install.sh
|
||||||
|
- name: Deploy docs
|
||||||
|
uses: mhausenblas/mkdocs-deploy-gh-pages@master
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
CUSTOM_DOMAIN: toolkit.fluxcd.io
|
@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg width="64px" height="64px" viewBox="0 0 64 64" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
|
<!-- Generator: Sketch 56.3 (81716) - https://sketch.com -->
|
||||||
|
<title>flux-icon</title>
|
||||||
|
<desc>Created with Sketch.</desc>
|
||||||
|
<g id="flux-icon" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||||
|
<g id="Group" transform="translate(11.000000, 2.000000)">
|
||||||
|
<path d="M0.803134615,15.7791346 C-0.246288462,15.0966346 -0.246288462,13.5602885 0.803134615,12.8783654 L20.1819808,0.279519231 C20.7554423,-0.0931730769 21.4944808,-0.0931730769 22.0679423,0.279519231 L41.4473654,12.8783654 C42.4967885,13.5602885 42.4967885,15.0966346 41.4473654,15.7791346 L22.0679423,28.3779808 C21.4944808,28.7506731 20.7554423,28.7506731 20.1819808,28.3779808 L0.803134615,15.7791346 Z" id="Fill-1" fill="#326CE5"></path>
|
||||||
|
<path d="M24.1851346,18.0023077 L25.5293654,18.0023077 C26.3145577,18.0023077 26.8055192,17.1525 26.4126346,16.4728846 L22.0084038,8.84423077 C21.6160962,8.16461538 20.63475,8.16461538 20.2418654,8.84423077 L15.8376346,16.4728846 C15.4453269,17.1525 15.9357115,18.0023077 16.7209038,18.0023077 L18.0657115,18.0023077 C18.6287885,18.0023077 19.0851346,18.4592308 19.0851346,19.0223077 L19.0851346,27.7298077 L19.9874423,28.3165385 C20.6791731,28.7665385 21.5710962,28.7665385 22.2628269,28.3165385 L23.1651346,27.7298077 L23.1651346,19.0223077 C23.1651346,18.4592308 23.6214808,18.0023077 24.1851346,18.0023077" id="Fill-3" fill="#C1D2F7"></path>
|
||||||
|
<path d="M27.8390769,34.8375577 L23.1648462,31.7989038 L23.1648462,33.2389038 C24.6902308,33.8919808 26.2588846,34.4008269 27.8390769,34.8375577" id="Fill-5" fill="#326CE5"></path>
|
||||||
|
<path d="M23.1650769,35.8280192 L23.1650769,37.8495577 C24.7095,38.3209038 26.2723846,38.7080192 27.8191154,39.0893654 C32.8706538,40.3349423 37.6418077,41.5107115 41.4783462,45.3478269 C41.6733462,45.54225 41.8562308,45.7407115 42.0373846,45.93975 C42.4308462,45.1880192 42.2335385,44.1957115 41.4466154,43.6845577 L33.8560385,38.7489808 C32.0133462,38.1409038 30.1360385,37.6759038 28.2806538,37.2189808 C26.5308462,36.7874423 24.8196923,36.3570577 23.1650769,35.8280192" id="Fill-7" fill="#326CE5"></path>
|
||||||
|
<path d="M19.08525,34.1699423 C18.4304423,33.8318654 17.7854423,33.4689808 17.1629423,33.0489808 L15.4269808,34.1774423 C16.5975577,35.0382115 17.8235192,35.7362885 19.08525,36.3212885 L19.08525,34.1699423 Z" id="Fill-9" fill="#326CE5"></path>
|
||||||
|
<path d="M24.8941731,40.6051154 C24.3137885,40.4620385 23.7374423,40.3195385 23.1651346,40.1735769 L23.1651346,42.1605 C23.5885962,42.2666538 24.0114808,42.3722308 24.4326346,42.4760769 C29.4841731,43.7210769 34.2553269,44.8968462 38.0924423,48.7339615 C38.0987885,48.7408846 38.1045577,48.7472308 38.1114808,48.7541538 L39.75225,47.6868462 C39.6524423,47.5824231 39.5584038,47.4751154 39.4545577,47.3718462 C35.2384038,43.1551154 29.9791731,41.8587692 24.8941731,40.6051154" id="Fill-11" fill="#326CE5"></path>
|
||||||
|
<path d="M19.08525,38.9907115 C16.8900577,38.2389808 14.8096731,37.2714808 12.9115962,35.8124423 L11.2119808,36.9178269 C13.6287115,38.9110962 16.3194808,40.1203269 19.08525,41.0168654 L19.08525,38.9907115 Z" id="Fill-13" fill="#326CE5"></path>
|
||||||
|
<path d="M19.08525,43.3809808 C15.3069808,42.3909808 11.7537115,41.18175 8.71794231,38.5388654 L7.04717308,39.6252115 C10.6125577,42.9102115 14.8540962,44.2832885 19.08525,45.3707885 L19.08525,43.3809808 Z" id="Fill-15" fill="#326CE5"></path>
|
||||||
|
<path d="M23.1650769,46.3935 C27.1175769,47.4140769 30.8341154,48.6342692 33.9823846,51.4381154 L35.6439231,50.3581154 C31.9654615,46.9000385 27.5514231,45.5194615 23.1650769,44.4048462 L23.1650769,46.3935 Z" id="Fill-17" fill="#326CE5"></path>
|
||||||
|
<path d="M4.57875,41.2299231 L2.92990385,42.3018462 C2.98759615,42.3612692 3.04009615,42.423 3.09951923,42.4818462 C7.31625,46.6985769 12.5743269,47.9949231 17.6599038,49.2485769 C22.0641346,50.3337692 26.2543269,51.3687692 29.7989423,54.1581923 L31.4893269,53.0591538 C27.4958654,49.6968462 22.7385577,48.5158846 18.1214423,47.3781923 C13.1206731,46.1453077 8.39567308,44.9758846 4.57875,41.2299231" id="Fill-19" fill="#326CE5"></path>
|
||||||
|
<path d="M1.07555769,44.5060962 C0.883442308,44.3139808 0.702865385,44.1184038 0.524019231,43.9216731 C-0.227711538,44.6745577 -0.139442308,45.9726346 0.80325,46.5853269 L6.50959615,50.2955192 C9.03536538,51.3409038 11.6765192,51.9945577 14.2738269,52.6349423 C18.3284423,53.6341731 22.2019038,54.5924423 25.5578654,56.9157115 L27.2834423,55.7930192 C23.4676731,52.9245577 19.0403654,51.8255192 14.7347885,50.7639808 C9.68382692,49.5189808 4.91267308,48.3432115 1.07555769,44.5060962" id="Fill-21" fill="#326CE5"></path>
|
||||||
|
<path d="M19.6441154,58.8342692 C20.0243077,59.0188846 20.3998846,59.2133077 20.7691154,59.4221538 C21.2093077,59.5150385 21.6771923,59.4383077 22.0683462,59.1838846 L23.0260385,58.5613846 C19.9493077,56.5035 16.5287308,55.461 13.1196923,54.5927308 L19.6441154,58.8342692 Z" id="Fill-23" fill="#326CE5"></path>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 5.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 6.6 KiB |
@ -0,0 +1,24 @@
|
|||||||
|
@import url("https://fonts.googleapis.com/css?family=Montserrat&display=swap");
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: "Montserrat", sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
.md-logo {
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
padding-bottom: 2px;
|
||||||
|
padding-top: 2px;
|
||||||
|
}
|
||||||
|
.md-logo img {
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.md-header, .md-footer-nav {
|
||||||
|
background-image: linear-gradient(45deg, rgb(0, 150, 225) 0%, rgb(27, 141, 226) 24%, rgb(42, 125, 227) 53%, rgb(53, 112, 227) 78%, rgb(53, 112, 227) 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.md-header-nav__title {
|
||||||
|
font-size: .85rem;
|
||||||
|
}
|
@ -0,0 +1,216 @@
|
|||||||
|
# Get started with GitOps Toolkit
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
* Kubernetes >= 1.14
|
||||||
|
* kubectl >= 1.18
|
||||||
|
* git
|
||||||
|
|
||||||
|
You will need to have Kubernetes set up.
|
||||||
|
For a quick local test, you can use `minikube`, `kubeadm` or `kind`.
|
||||||
|
Any other Kubernetes setup will work as well though.
|
||||||
|
|
||||||
|
In order to follow the guide you'll need a GitHub account and a
|
||||||
|
[personal access token](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line)
|
||||||
|
that can create repositories.
|
||||||
|
|
||||||
|
## Install the toolkit CLI
|
||||||
|
|
||||||
|
To install the latest `tk` release run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -s https://toolkit.fluxcd.io/install.sh | sudo bash
|
||||||
|
```
|
||||||
|
|
||||||
|
The install script downloads the tk binary to `/usr/local/bin`.
|
||||||
|
Binaries for macOS and Linux AMD64 are available for download on the
|
||||||
|
[release page](https://github.com/fluxcd/toolkit/releases).
|
||||||
|
|
||||||
|
To configure your shell to load tk completions add to your bash profile:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# ~/.bashrc or ~/.bash_profile
|
||||||
|
. <(tk completion)
|
||||||
|
```
|
||||||
|
|
||||||
|
Verify that your cluster satisfies the prerequisites with:
|
||||||
|
|
||||||
|
```text
|
||||||
|
$ tk check --pre
|
||||||
|
|
||||||
|
► checking prerequisites
|
||||||
|
✔ kubectl 1.18.3 >=1.18.0
|
||||||
|
✔ kubernetes 1.16.8-eks-e16311 >=1.14.0
|
||||||
|
✔ prerequisites checks passed
|
||||||
|
```
|
||||||
|
|
||||||
|
## Bootstrap
|
||||||
|
|
||||||
|
You'll be using a dedicated Git repository e.g. `fleet-infra` to manage one or more Kubernetes clusters.
|
||||||
|
|
||||||
|
First export your GitHub personal access token and GitHub username:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
export GITHUB_TOKEN=<your-token>
|
||||||
|
export GITHUB_USER=<your-username>
|
||||||
|
```
|
||||||
|
|
||||||
|
The bootstrap command creates a repository if one doesn't exist and
|
||||||
|
commits the toolkit components manifests to the master branch at the specified path.
|
||||||
|
Then it configures the target cluster to synchronize with the specified path inside the repository.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
tk bootstrap github \
|
||||||
|
--owner=$GITHUB_USER \
|
||||||
|
--repository=fleet-infra \
|
||||||
|
--path=dev-cluster \
|
||||||
|
--personal
|
||||||
|
```
|
||||||
|
|
||||||
|
If you wish to create the repository under a GitHub organization:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
tk bootstrap github \
|
||||||
|
--owner=<organization> \
|
||||||
|
--repository=<repo-name> \
|
||||||
|
--team=<team1-slug> \
|
||||||
|
--team=<team2-slug> \
|
||||||
|
--path=dev-cluster
|
||||||
|
```
|
||||||
|
|
||||||
|
Example output:
|
||||||
|
|
||||||
|
```text
|
||||||
|
$ tk bootstrap github --owner=gitopsrun --repository=fleet-infra --path=dev-cluster --team=devs
|
||||||
|
|
||||||
|
► connecting to github.com
|
||||||
|
✔ repository created
|
||||||
|
✔ devs team access granted
|
||||||
|
✔ repository cloned
|
||||||
|
✚ generating manifests
|
||||||
|
✔ components manifests pushed
|
||||||
|
► installing components in gitops-system namespace
|
||||||
|
namespace/gitops-system created
|
||||||
|
customresourcedefinition.apiextensions.k8s.io/gitrepositories.source.fluxcd.io created
|
||||||
|
customresourcedefinition.apiextensions.k8s.io/helmcharts.source.fluxcd.io created
|
||||||
|
customresourcedefinition.apiextensions.k8s.io/helmrepositories.source.fluxcd.io created
|
||||||
|
customresourcedefinition.apiextensions.k8s.io/kustomizations.kustomize.fluxcd.io created
|
||||||
|
customresourcedefinition.apiextensions.k8s.io/profiles.kustomize.fluxcd.io created
|
||||||
|
role.rbac.authorization.k8s.io/crd-controller-gitops-system created
|
||||||
|
rolebinding.rbac.authorization.k8s.io/crd-controller-gitops-system created
|
||||||
|
clusterrolebinding.rbac.authorization.k8s.io/cluster-reconciler-gitops-system created
|
||||||
|
service/source-controller created
|
||||||
|
deployment.apps/kustomize-controller created
|
||||||
|
deployment.apps/source-controller created
|
||||||
|
networkpolicy.networking.k8s.io/deny-ingress created
|
||||||
|
Waiting for deployment "source-controller" rollout to finish: 0 of 1 updated replicas are available...
|
||||||
|
deployment "source-controller" successfully rolled out
|
||||||
|
deployment "kustomize-controller" successfully rolled out
|
||||||
|
✔ install completed
|
||||||
|
► configuring deploy key
|
||||||
|
✔ deploy key configured
|
||||||
|
► generating sync manifests
|
||||||
|
✔ sync manifests pushed
|
||||||
|
► applying sync manifests
|
||||||
|
◎ waiting for cluster sync
|
||||||
|
✔ bootstrap finished
|
||||||
|
```
|
||||||
|
|
||||||
|
If you prefer GitLab, export `GITLAB_TOKEN` env var and use the command [tk bootstrap gitlab](../cmd/tk_bootstrap_gitlab.md).
|
||||||
|
|
||||||
|
It is safe to run the bootstrap command as many times as you want.
|
||||||
|
If the toolkit components are present on the cluster,
|
||||||
|
the bootstrap command will perform an upgrade if needed.
|
||||||
|
|
||||||
|
## Create a GitOps workflow
|
||||||
|
|
||||||
|
Clone the repository with:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git clone https://github.com/$GITHUB_USER/fleet-infra
|
||||||
|
cd fleet-infra
|
||||||
|
```
|
||||||
|
|
||||||
|
Create a git source pointing to a public repository:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
tk create source git webapp \
|
||||||
|
--url=https://github.com/stefanprodan/podinfo \
|
||||||
|
--branch=master \
|
||||||
|
--interval=30s \
|
||||||
|
--export > ./dev-cluster/webapp-source.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
Create a kustomization for synchronizing the common manifests on the cluster:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
tk create kustomization webapp-common \
|
||||||
|
--source=webapp \
|
||||||
|
--path="./deploy/webapp/common" \
|
||||||
|
--prune=true \
|
||||||
|
--validate=client \
|
||||||
|
--interval=1h \
|
||||||
|
--export > ./dev-cluster/webapp-common.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
Create a kustomization for the backend service that depends on common:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
tk create kustomization webapp-backend \
|
||||||
|
--depends-on=webapp-common \
|
||||||
|
--source=webapp \
|
||||||
|
--path="./deploy/webapp/backend" \
|
||||||
|
--prune=true \
|
||||||
|
--validate=client \
|
||||||
|
--interval=10m \
|
||||||
|
--health-check="Deployment/backend.webapp" \
|
||||||
|
--health-check-timeout=2m \
|
||||||
|
--export > ./dev-cluster/webapp-backend.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
Create a kustomization for the frontend service that depends on backend:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
tk create kustomization webapp-frontend \
|
||||||
|
--depends-on=webapp-backend \
|
||||||
|
--source=webapp \
|
||||||
|
--path="./deploy/webapp/frontend" \
|
||||||
|
--prune=true \
|
||||||
|
--validate=client \
|
||||||
|
--interval=10m \
|
||||||
|
--health-check="Deployment/frontend.webapp" \
|
||||||
|
--health-check-timeout=2m \
|
||||||
|
--export > ./dev-cluster/webapp-frontend.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
Push changes to origin:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git add -A && git commit -m "add webapp" && git push
|
||||||
|
```
|
||||||
|
|
||||||
|
In about 30s the synchronization should start:
|
||||||
|
|
||||||
|
```text
|
||||||
|
$ watch tk get kustomizations
|
||||||
|
|
||||||
|
✔ gitops-system last applied revision master/35d5765a1acb9e9ce66cad7274c6fe03eee1e8eb
|
||||||
|
✔ webapp-backend reconciling
|
||||||
|
✔ webapp-common last applied revision master/f43f9b2eb6766e07f318d266a99d2ec7c940b0cf
|
||||||
|
✗ webapp-frontend dependency 'gitops-system/webapp-backend' is not ready
|
||||||
|
```
|
||||||
|
|
||||||
|
When the synchronization finishes you can check that the webapp services are running:
|
||||||
|
|
||||||
|
```text
|
||||||
|
$ kubectl -n webapp get deployments,services
|
||||||
|
|
||||||
|
NAME READY UP-TO-DATE AVAILABLE AGE
|
||||||
|
deployment.apps/backend 1/1 1 1 4m1s
|
||||||
|
deployment.apps/frontend 1/1 1 1 3m31s
|
||||||
|
|
||||||
|
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
|
||||||
|
service/backend ClusterIP 10.52.10.22 <none> 9898/TCP,9999/TCP 4m1s
|
||||||
|
service/frontend ClusterIP 10.52.9.85 <none> 80/TCP 3m31s
|
||||||
|
```
|
||||||
|
|
@ -0,0 +1,20 @@
|
|||||||
|
# GitOps Toolkit
|
||||||
|
|
||||||
|
The GitOps Toolkit is a set of composable APIs and specialized tools
|
||||||
|
that can be used to build a Continuous Delivery platform on top of Kubernetes.
|
||||||
|
|
||||||
|
These tools are built with Kubernetes controller-runtime libraries and they
|
||||||
|
can be dynamically configured with Kubernetes custom resources either by
|
||||||
|
cluster admins or by other automated tools.
|
||||||
|
The GitOps Toolkit components interact with each other via Kubernetes
|
||||||
|
events and are responsible for the reconciliation of their designated API objects.
|
||||||
|
|
||||||
|
![](diagrams/tk-overview.png)
|
||||||
|
|
||||||
|
Components:
|
||||||
|
|
||||||
|
- [Toolkit CLI](https://github.com/fluxcd/toolkit)
|
||||||
|
- [Source Controller](https://github.com/fluxcd/source-controller)
|
||||||
|
- [Kustomize Controller](https://github.com/fluxcd/kustomize-controller)
|
||||||
|
|
||||||
|
To get started with the toolkit please follow this [guide](get-started/index.md).
|
@ -0,0 +1,51 @@
|
|||||||
|
site_name: GitOps Toolkit
|
||||||
|
site_description: Documentation for GitOps Toolkit.
|
||||||
|
site_author: The Flux contributors
|
||||||
|
site_url: https://fluxcd.github.io/toolkit/
|
||||||
|
|
||||||
|
# Repository
|
||||||
|
repo_name: fluxcd/toolkit
|
||||||
|
repo_url: https://github.com/fluxcd/toolkit
|
||||||
|
edit_uri: ""
|
||||||
|
|
||||||
|
theme:
|
||||||
|
name: material
|
||||||
|
logo: _files/flux-icon@2x.png
|
||||||
|
language: en
|
||||||
|
palette:
|
||||||
|
primary: blue
|
||||||
|
accent: indigo
|
||||||
|
|
||||||
|
docs_dir: docs
|
||||||
|
|
||||||
|
extra_css:
|
||||||
|
- _static/custom.css
|
||||||
|
|
||||||
|
plugins:
|
||||||
|
- search
|
||||||
|
|
||||||
|
markdown_extensions:
|
||||||
|
- admonition
|
||||||
|
- codehilite:
|
||||||
|
guess_lang: false
|
||||||
|
- toc:
|
||||||
|
permalink: true
|
||||||
|
- pymdownx.superfences:
|
||||||
|
highlight_code: true
|
||||||
|
- pymdownx.tabbed
|
||||||
|
|
||||||
|
nav:
|
||||||
|
- Introduction: index.md
|
||||||
|
- Get Started: get-started/index.md
|
||||||
|
- Toolkit CLI:
|
||||||
|
- Bootstrap: cmd/tk_bootstrap.md
|
||||||
|
- Check: cmd/tk_check.md
|
||||||
|
- Create: cmd/tk_create.md
|
||||||
|
- Delete: cmd/tk_delete.md
|
||||||
|
- Export: cmd/tk_export.md
|
||||||
|
- Get: cmd/tk_get.md
|
||||||
|
- Install: cmd/tk_install.md
|
||||||
|
- Resume: cmd/tk_resume.md
|
||||||
|
- Suspend: cmd/tk_suspend.md
|
||||||
|
- Synchronize: cmd/tk_sync.md
|
||||||
|
- Uninstall: cmd/tk_uninstall.md
|
Loading…
Reference in New Issue