This repo contains a basic example of how flux can be used to deploy kubernetes workloads.
- Fork this repo into your own github (click the fork button at the top right of this page)
- Clone this repo on to your workstation (replace
jwenz723
with your username):git clone https://github.com/jwenz723/kubernetes-workshop-flux.git
- cd into scripts
- Install tiller into your cluster by running
helm init --wait
. Tiller is the server-side component that helm interacts with. - execute the script for your OS
(before you execute the script modify
git@github.com:jwenz723/kubernetes-workshop-flux
to replacejwenz723
with your github username)- windows: flux-init.bat
- linux/mac: flux-init.sh
- Copy the ssh public key that is printed when the script finishes (should start with
ssh-rsa
) - Browse to (replace
jwenz723
with your username) https://github.com/jwenz723/kubernetes-workshop-flux/settings/keys/new to create a new deploy key - Set the title to 'kubernetes-workshop'
- Set the key value to the ssh key you copied earlier
- Check the box 'Allow write access' to allow flux to commit back to the repo
- Click Add Key
- Watch the flux logs to see if it is working using the command:
kubectl logs -n flux -l app=flux -f
Assuming that you made some changes to the apps, you should make changes in this repo to make use of your newly created docker images.
-
Modify backend-dep.yaml to point at your docker image (change this line:
image: jwenz723/demohttp-backend:flux-sync-3-gd84c559-dirty
) -
Modify frontend-dep.yaml to point at your docker image (change this line:
image: jwenz723/demohttp-frontend:flux-sync-3-gd84c559-dirty
) -
Make a new git commit and push your changes up to github:
git add . git commit -m "updated docker image path" git push origin master
-
Now watch your minikube cluster to see your new image deployed:
kubectl get pods -w
(you should see theAGE
value in the right column drop to a value less than 10s when your new pod is created)
-
To delete everything that was deployed by this flux installation run the script for your OS:
- windows: flux-cleanup.bat
- linux/mac: flux-cleanup.sh
-
(Optional) Go into github and delete the fork that you created
Try adding a deployment of your application of choice into the repo and have it deployed through flux. You can define yaml files for your deployment within the k8s directory following the pattern of what is already defined there.