This commit is contained in:
marcel-dempers 2020-06-30 16:51:02 +10:00
parent 97535fc3d7
commit 91ea892b36

View File

@ -2,70 +2,40 @@
# 1 - Kubernetes # 1 - Kubernetes
For this tutorial, I use Kuberentes 1.17 Get a Kubernetes Cluster. In this video, I use Docker for Windows.
To get 1.17 for Linux\Windows, just use `kind` If you are new to Kubernetes, checkout my videos [here](https://marceldempers.dev/videos/guides/kubernetes-getting-started)
# 2 - Flux CTL
I used Flux 1.18 which I got from the GitHub [Release Page](https://github.com/fluxcd/flux/releases/tag/1.18.0)
Rename it to `fluxctl.exe` & place it in a folder that is on your `$env:Path` environment variable.
Open a new terminal and try
``` ```
#Windows fluxctl
kind create cluster --name flux --image kindest/node:v1.17.0@sha256:9512edae126da271b66b990b6fff768fbb7cd786c7d39e86bdf55906352fdf62
#Linux
kind create cluster --name flux --kubeconfig ~/.kube/kind-flux --image kindest/node:v1.17.0@sha256:9512edae126da271b66b990b6fff768fbb7cd786c7d39e86bdf55906352fdf62
```
You can use Kubernetes from Docker for Windows\Mac too! :)
# 2 - Flux CLI Container
Let's run a docker container that can access our Kind cluster and run all the dependencies
for Flux.
If you installed Flux CTL & KubeCTL on your machine, go to Part 4
```
# Note: make sure we mount the correct network, check the network used (should be bridge)
#grab the ip address
docker inspect flux-control-plane
docker run -it --rm --net bridge -v ${home}/.kube/:/root/.kube/ ubuntu:19.10 bash
apt-get update && apt-get install -y nano curl
# edit kubeconfig, set api address so we can access it from our container
nano ~/.kube/config
# set it to https://flux-control-plane:6443
```
# 3 - Get kubectl and Flux CTL
```
curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl
chmod +x ./kubectl
mv ./kubectl /usr/local/bin/kubectl
# confirm we can access kind cluster:
kubectl get nodes
curl -o fluxctl -L https://github.com/fluxcd/flux/releases/download/1.19.0/fluxctl_linux_amd64
chmod +x ./fluxctl
mv ./fluxctl /usr/local/bin/fluxctl
``` ```
# 4 - Installing Flux # 4 - Installing Flux
Make sure you are pointing to the kubernetes cluster you want to use
```
kubectl config current-context
kubectl get nodes
```
``` ```
kubectl create ns flux kubectl create ns flux
export GHUSER="marcel-dempers" $GHUSER = "marcel-dempers"
fluxctl install \ fluxctl install `
--git-user=${GHUSER} \ --git-user=${GHUSER} `
--git-email=${GHUSER}@users.noreply.github.com \ --git-email=${GHUSER}@users.noreply.github.com `
--git-url=git@github.com:${GHUSER}/docker-development-youtube-series \ --git-url=git@github.com:${GHUSER}/docker-development-youtube-series `
--git-path=kubernetes/configmaps,kubernetes/secrets,kubernetes/deployments \ --git-path=kubernetes/configmaps,kubernetes/secrets,kubernetes/deployments `
--git-branch=flux-test `
--namespace=flux | kubectl apply -f - --namespace=flux | kubectl apply -f -
kubectl -n flux rollout status deployment/flux kubectl -n flux rollout status deployment/flux
export FLUX_FORWARD_NAMESPACE=flux $env:FLUX_FORWARD_NAMESPACE = "flux"
fluxctl list-workloads fluxctl list-workloads
fluxctl identity fluxctl identity
@ -73,4 +43,9 @@ fluxctl identity
https://github.com/marcel-dempers/docker-development-youtube-series/settings/keys/new https://github.com/marcel-dempers/docker-development-youtube-series/settings/keys/new
fluxctl sync fluxctl sync
fluxcd.io/tag.example-app: semver:~1.0
fluxcd.io/automated: 'true'
fluxctl policy -w default:deployment/example-deploy --tag "example-app=1.0.*"
``` ```