Giter VIP home page Giter VIP logo

hiringhw's Introduction

Requirements

For running the examples, the following packages are required:

docker
fluxcd
git
kubectl
kubernetes-helm
minikube

I installed them using nix-shell.

Bootstrapping Flux

First, the cluster needs to be spun up:

minikube start

After creating a repository on Github (janlikar/hiringhw) we can bootstrap flux:

flux bootstrap git \
  --components-extra=image-reflector-controller,image-automation-controller \
  --url=ssh://[email protected]/janlikar/hiringhw \
  --branch=main \
  --private-key-file=/home/jan/.ssh/id_ed25519 \
  --path=clusters/production

Installing a Helm chart

A helm chart to install Wordpress can be generated using the following commands:

flux create source helm wordpress --url https://charts.bitnami.com/bitnami --export > clusters/production/wordpress-source.yml
flux create hr wordpress --chart wordpress --source HelmRepository/wordpress --export > clusters/production/wordpress.yml

We need to add the following lines to spec in clusters/production/wordpress.yml1:

values:
  image:
    tag: 6.4.2
  service:
    type: NodePort

Then we can commit & push the generated files:

git add clusters/production/wordpress-source.yml clusters/production/wordpress.yml && git commit -m "Add wordpress"

Enabling automatic image updates

flux create image repository wordpress --image bitnami/wordpress --export > clusters/production/wordpress-repository.yml
flux create image policy wordpress --image-ref=wordpress --select-semver=6.4.x --export > ./clusters/production/wordpress-policy.yaml

Add the # {"$imagepolicy": "flux-system:wordpress"} comment next to a tag specifier in clusters/production/wordpress-repository.yml.

Finally, we generate an ImageUpdateAutomation and push it to our git repo:

flux create image update flux-system \
--interval=30m \
--git-repo-ref=flux-system \
--git-repo-path="./clusters/production" \
--checkout-branch=main \
--push-branch=main \
--author-name=fluxcdbot \
[email protected] \
--commit-template="{{range .Updated.Images}}{{println .}}{{end}}" \
--export > ./clusters/production/flux-system-automation.yaml

git add clusters/production/flux-system-automation.yaml
git commit -m "Enable image automation"
git push

Footnotes

  1. In real world applications we would probabaly use a LoadBalancer, not NodePort, for service.type. โ†ฉ

hiringhw's People

Contributors

janlikar avatar fluxcdbot avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.