Step-by-step run-through on how to use Flux and Helm Operator over here.
More advanced Helm setup, take a look at the
fluxcd/helm-operator-get-started
repository.
$ ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa -q -N ""
$ cat ~/.ssh/id_rsa.pub
// FluxCtl Installation
$ curl -sL https://fluxcd.io/install | sh && chmod +x $HOME/.fluxcd/bin/fluxctl && sudo mv $HOME/.fluxcd/bin/fluxctl /usr/local/bin/
$ export PATH=$PATH:$HOME/.fluxcd/bin
$ helm repo add fluxcd https://charts.fluxcd.io
$ kubectl create namespace fluxcd
$ kubectl apply -f https://raw.githubusercontent.com/fluxcd/helm-operator/master/deploy/crds.yaml
$ helm upgrade -i flux fluxcd/flux --wait \
--namespace fluxcd \
--set [email protected]:webmak1/flux-get-started \
--set git.timeout=3m \
--set git.pollInterval=1m \
--set resources.requests.cpu=500m \
--set resources.requests.memory=500Mi \
--set sync.timeout=3m \
--set helm.versions=v3
$ helm upgrade -i helm-operator fluxcd/helm-operator --wait \
--namespace fluxcd \
--set git.ssh.secretName=flux-git-deploy \
--set helm.versions=v3
$ fluxctl --k8s-fwd-ns fluxcd identity
GITHUB --> Project (flux-get-started) --> SETTINGS --> DELPLOY KEYS
+ allow write access
$ fluxctl --k8s-fwd-ns=fluxcd sync
$ kubectl logs -n fluxcd deployment/flux -f
$ kubectl logs -n fluxcd deploy/helm-operator -f
$ watch kubectl -n fluxcd get pods
$ helm list --namespace demo
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
ghost demo 1 2021-01-16 17:27:59.501952901 +0000 UTCdeployed ghost-9.0.4 3.1.1
$ kubectl get pods -n demo
NAME READY STATUS RESTARTS AGE
ghost-55c87c6bd5-g9vs5 0/1 ContainerCreating 0 62s
ghost-mariadb-0 0/1 ContainerCreating 0 61s
podinfo-6fb4c8894d-9gp98 1/1 Running 0 78s
podinfo-6fb4c8894d-j9b8x 1/1 Running 0 62s
$ kubectl get svc -n demo
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
ghost ClusterIP 10.100.79.47 <none> 80/TCP 79s
ghost-mariadb ClusterIP 10.103.249.225 <none> 3306/TCP 79s
podinfo ClusterIP 10.105.27.5 <none> 9898/TCP 95s
$ kubectl get deployments -n demo
NAME READY UP-TO-DATE AVAILABLE AGE
ghost 0/1 1 0 2m5s
podinfo 2/2 2 2 2m21s
$ kubectl describe -n demo deployment/podinfo | grep Image
Image: alpine:3.10
Image: stefanprodan/podinfo:3.1.5
https://github.com/webmak1/flux-get-started/edit/master/releases/mongodb.yaml
set
tag: 4.0.14
vait for 5 minutes.
$ kubectl -n fluxcd logs deployment/flux -f
$ kubectl describe -n demo deployment/mongodb | grep Image
Image: docker.io/bitnami/mongodb:4.0.14
$ fluxctl --k8s-fwd-ns=flux sync
Error: git repository ssh://[email protected]/webmakaka/flux-get-started is not ready to sync
Full error message: running git command: git [push --delete [email protected]:webmakaka/flux-get-started tag flux-write-check-1b50d03dc8]: context deadline exceeded
To solve this issue use
--set git.timeout=3m
Marley