From 4888ec1f5b35b9d920d7f695b3e95157aa2d953a Mon Sep 17 00:00:00 2001 From: Guilhem Lettron Date: Wed, 29 Apr 2020 21:54:27 +0200 Subject: [PATCH 1/6] gitops: add bash highlight --- slides/k8s/gitworkflows.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/slides/k8s/gitworkflows.md b/slides/k8s/gitworkflows.md index 74e7a624..0e09200a 100644 --- a/slides/k8s/gitworkflows.md +++ b/slides/k8s/gitworkflows.md @@ -86,7 +86,7 @@ ## Setting up Flux - Clone the Flux repository: - ``` + ```bash git clone https://github.com/fluxcd/flux ``` @@ -99,7 +99,7 @@ ``` - Apply all the YAML: - ``` + ```bash kubectl apply -f deploy/ ``` @@ -110,7 +110,7 @@ - When it starts, Flux generates an SSH key - Display that key: - ``` + ```bash kubectl logs deployment/flux | grep identity ``` @@ -157,14 +157,14 @@ ## Setting up Gitkube - Install the CLI: - ``` + ```bash sudo curl -L -o /usr/local/bin/gitkube \ https://github.com/hasura/gitkube/releases/download/v0.2.1/gitkube_linux_amd64 sudo chmod +x /usr/local/bin/gitkube ``` - Install Gitkube on the cluster: - ``` + ```bash gitkube install --expose ClusterIP ``` @@ -196,20 +196,20 @@ ## Pushing to our remote - Get the `gitkubed` IP address: - ``` + ```bash kubectl -n kube-system get svc gitkubed IP=$(kubectl -n kube-system get svc gitkubed -o json | jq -r .spec.clusterIP) ``` - Get ourselves a sample repository with resource YAML files: - ``` + ```bash git clone git://github.com/jpetazzo/kubercoins cd kubercoins ``` - Add the remote and push to it: - ``` + ```bash git remote add k8s ssh://default-example@$IP/~/git/default-example git push k8s master ``` From 57af933c2de7a4eb9c66151a19ba801a1e98780a Mon Sep 17 00:00:00 2001 From: Guilhem Lettron Date: Wed, 29 Apr 2020 21:55:56 +0200 Subject: [PATCH 2/6] gitops: add missing `cd` --- slides/k8s/gitworkflows.md | 1 + 1 file changed, 1 insertion(+) diff --git a/slides/k8s/gitworkflows.md b/slides/k8s/gitworkflows.md index 0e09200a..9c654f14 100644 --- a/slides/k8s/gitworkflows.md +++ b/slides/k8s/gitworkflows.md @@ -88,6 +88,7 @@ - Clone the Flux repository: ```bash git clone https://github.com/fluxcd/flux + cd flux ``` - Edit `deploy/flux-deployment.yaml` From a772fff88e8620265aa6dc2c1a37c34609d767cf Mon Sep 17 00:00:00 2001 From: Guilhem Lettron Date: Wed, 29 Apr 2020 21:56:31 +0200 Subject: [PATCH 3/6] gitops: flux use kustomize --- slides/k8s/gitworkflows.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/slides/k8s/gitworkflows.md b/slides/k8s/gitworkflows.md index 9c654f14..9f98f507 100644 --- a/slides/k8s/gitworkflows.md +++ b/slides/k8s/gitworkflows.md @@ -83,7 +83,7 @@ --- -## Setting up Flux +## Setting up Flux with kustomize - Clone the Flux repository: ```bash @@ -101,7 +101,7 @@ - Apply all the YAML: ```bash - kubectl apply -f deploy/ + kubectl apply -k deploy/ ``` --- From 66b7d118bab49dbcb4bc68767be00b9b8f775261 Mon Sep 17 00:00:00 2001 From: Guilhem Lettron Date: Wed, 29 Apr 2020 22:04:41 +0200 Subject: [PATCH 4/6] gitops: add Flux helm install method --- slides/k8s/gitworkflows.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/slides/k8s/gitworkflows.md b/slides/k8s/gitworkflows.md index 9f98f507..957fbceb 100644 --- a/slides/k8s/gitworkflows.md +++ b/slides/k8s/gitworkflows.md @@ -106,6 +106,25 @@ --- +## Setting up Flux with Helm + +- Add Flux helm repo: + ```bash + helm repo add fluxcd https://charts.fluxcd.io + ``` + +- Install Flux: + ```bash + kubectl create namespace flux + helm upgrade --install flux \ + --set git.url=git@github.com:your-git-username/kubercoins \ + --set git.branch=prod \ + --namespace flux \ + fluxcd/flux + ``` + +--- + ## Allowing Flux to access the repository - When it starts, Flux generates an SSH key From 8c04154430ad27d7f8d907807b53e9f1fa72a1ab Mon Sep 17 00:00:00 2001 From: Guilhem Lettron Date: Wed, 29 Apr 2020 22:07:02 +0200 Subject: [PATCH 5/6] gitops: update Flux log for identity.pub --- slides/k8s/gitworkflows.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slides/k8s/gitworkflows.md b/slides/k8s/gitworkflows.md index 957fbceb..a8bc318b 100644 --- a/slides/k8s/gitworkflows.md +++ b/slides/k8s/gitworkflows.md @@ -131,7 +131,7 @@ - Display that key: ```bash - kubectl logs deployment/flux | grep identity + kubectl -n flux logs deployment/flux | grep identity.pub | cut -d '"' -f2 ``` - Then add that key to the repository, giving it **write** access From 3d724d87db050ac68d8397c44162c90129d27c4d Mon Sep 17 00:00:00 2001 From: Guilhem Lettron Date: Wed, 29 Apr 2020 22:09:52 +0200 Subject: [PATCH 6/6] gitops: update create branch method --- slides/k8s/gitworkflows.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slides/k8s/gitworkflows.md b/slides/k8s/gitworkflows.md index a8bc318b..36b2c053 100644 --- a/slides/k8s/gitworkflows.md +++ b/slides/k8s/gitworkflows.md @@ -77,7 +77,7 @@ - Create a new branch in your fork; e.g. `prod` - (e.g. by adding a line in the README through the GitHub web UI) + (e.g. with "branch" dropdown through the GitHub web UI) - This is the branch that we are going to use for deployment