New Kubernetes GitOps Toolkit — Flux CD v2

---
apiVersion: source.toolkit.fluxcd.io/v1alpha1
kind: GitRepository
metadata:
creationTimestamp: null
name: gitops-system
namespace: gitops-system
spec:
interval: 1m0s
ref:
tag: 0.0.1
secretRef:
name: gitops-system
url: ssh://github.com/berndonline/gitops-toolkit
status: {}
---
apiVersion: source.toolkit.fluxcd.io/v1alpha1
kind: GitRepository
metadata:
creationTimestamp: null
name: gitops-system
namespace: gitops-system
spec:
interval: 1m0s
ref:
semver: '>=0.0.1 <0.1.0'
secretRef:
name: gitops-system
url: ssh://github.com/berndonline/gitops-toolkit
status: {}
.
|____cluster-dev
| |____kustomization.yaml
| |____hello-world_base
| | |____kustomization.yaml
| | |____deploy.yaml
|____common
|____kustomization.yaml
|____nginx-service.yaml
|____nginx_base
|____kustomization.yaml
|____service.yaml
|____nginx.yaml
---
apiVersion: kustomize.toolkit.fluxcd.io/v1alpha1
kind: Kustomization
metadata:
creationTimestamp: null
name: cluster-conf
namespace: gitops-system
spec:
interval: 5m0s
path: ./cluster-dev
prune: true
sourceRef:
kind: GitRepository
name: gitops-system
status: {}
---
apiVersion: kustomize.toolkit.fluxcd.io/v1alpha1
kind: Kustomization
metadata:
creationTimestamp: null
name: common-con
namespace: gitops-system
spec:
interval: 5m0s
path: ./common
prune: true
sourceRef:
kind: GitRepository
name: gitops-system
status: {}
$ git clone ssh://github.com/berndonline/gitops-toolkit
$ cd gitops-toolkit
$ mkdir -p ./cluster-dev/gitops-system
$ tk install --version=latest \
--export > ./cluster-dev/gitops-system/toolkit-components.yaml
$ kubectl apply -f ./cluster-dev/gitops-system/toolkit-components.yaml
namespace/gitops-system created
customresourcedefinition.apiextensions.k8s.io/alerts.notification.toolkit.fluxcd.io created
customresourcedefinition.apiextensions.k8s.io/gitrepositories.source.toolkit.fluxcd.io created
customresourcedefinition.apiextensions.k8s.io/helmcharts.source.toolkit.fluxcd.io created
customresourcedefinition.apiextensions.k8s.io/helmreleases.helm.toolkit.fluxcd.io created
customresourcedefinition.apiextensions.k8s.io/helmrepositories.source.toolkit.fluxcd.io created
customresourcedefinition.apiextensions.k8s.io/kustomizations.kustomize.toolkit.fluxcd.io created
customresourcedefinition.apiextensions.k8s.io/providers.notification.toolkit.fluxcd.io created
customresourcedefinition.apiextensions.k8s.io/receivers.notification.toolkit.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/notification-controller created
service/source-controller created
service/webhook-receiver created
deployment.apps/helm-controller created
deployment.apps/kustomize-controller created
deployment.apps/notification-controller created
deployment.apps/source-controller created
networkpolicy.networking.k8s.io/deny-ingress created
$ kubectl get pod -n gitops-system
NAME READY STATUS RESTARTS AGE
helm-controller-64f846df8c-g4mhv 1/1 Running 0 19s
kustomize-controller-6d9745c8cd-n8tth 1/1 Running 0 19s
notification-controller-587c49f7fc-ldcg2 1/1 Running 0 18s
source-controller-689dcd8bd7-rzp55 1/1 Running 0 18s
$ tk check
► checking prerequisites
✔ kubectl 1.18.3 >=1.18.0
✔ Kubernetes 1.18.6 >=1.16.0
► checking controllers
✔ source-controller is healthy
✔ kustomize-controller is healthy
✔ helm-controller is healthy
✔ notification-controller is healthy
✔ all checks passed
$ tk create source git gitops-system \
--url=ssh://github.com/berndonline/gitops-toolkit \
--ssh-key-algorithm=ecdsa \
--ssh-ecdsa-curve=p521 \
--branch=master \
--interval=1m
► generating deploy key pair
ecdsa-sha2-nistp521 xxxxxxxxxxx
Have you added the deploy key to your repository: y
► collecting preferred public key from SSH server
✔ collected public key from SSH server:
github.com ssh-rsa xxxxxxxxxxx
► applying secret with keys
✔ authentication configured
✚ generating source
► applying source
✔ source created
◎ waiting for git sync
✗ git clone error: remote repository is empty
$ tk create kustomization gitops-system \
--source=gitops-system \
--path="./cluster-dev" \
--prune=true \
--interval=5m
✚ generating kustomization
► applying kustomization
✔ kustomization created
◎ waiting for kustomization sync
✗ Source is not ready
$ tk export source git gitops-system \
> ./cluster-dev/gitops-system/toolkit-source.yaml
$ tk export kustomization gitops-system \
> ./cluster-dev/gitops-system/toolkit-kustomization.yaml
$ tk reconcile source git gitops-system
$ tk reconcile kustomization gitops-system

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store