项目作者: mhausenblas

项目描述 :
GitOps 101
高级语言:
项目地址: git://github.com/mhausenblas/gitops101.git
创建时间: 2019-11-01T12:04:05Z
项目社区:https://github.com/mhausenblas/gitops101

开源协议:Apache License 2.0

下载


GitOps 101

Preparation

Make sure you have a GitHub account set up and visit the trainings environment URL
provided in the slide deck.

First, fork this repo and clone it:

  1. git clone https://github.com/USERNAME/gitops101.git

Set up Flux

Install Flux in the Kubernetes cluster:

  1. cd gitops101
  2. kubectl apply -f ./flux/

Download fluxctl from github.com/fluxcd/flux/releases
and make it executable. For example, for Linux:

  1. curl -L -o fluxctl https://github.com/fluxcd/flux/releases/download/1.15.0/fluxctl_linux_amd64
  2. chmod +x fluxctl

Get the Flux operator’s public key:

  1. ./fluxctl identity

Next, configure your GitHub repo with above public key (under Settings -> Deploy keys).

Now, edit flux/flux-deployment.yaml to change/add:

  1. --git-url=<GIT URL OF YOUR REPOSITORY>
  2. --git-path=deploy/kubernetes

And make sure changes are reflected:

  1. kubectl apply -f flux/flux-deployment.yaml

Example flows

Now GitOps away:

  1. cp examples/podinfo-dep.yaml deploy/kubernetes
  2. git add deploy
  3. git commit -m "adds new deployment to cluster"
  4. git push origin master

Wait for some 5min until you see the podinfo deployment and pod:

  1. watch kubectl get pods,deploy

Other things to try:

  • Manually delete a deployment (kubectl delete deploy/podinfo)
  • Scale the podinfo deployment to 3 replicas
  • More via https://github.com/bricef/gitops-tutorial (the tutorial here is a stripped down version of this one)