Giter Club home page Giter Club logo

developerweeklatam2023's Introduction

DeveloperWeekLatam2023

Installing Flux

  1. Install the Flux CLI
curl -s https://fluxcd.io/install.sh | sudo bash
  1. Set the following environment variables
$ export GITHUB_USER=<YOUR_USER>
$ export GITHUB_TOKEN=<YOUR_GITHUB_TOKEN>
  1. Set your user to push data
$ git config --global user.email "<YOUR_EMAIL>"
$ git config --global user.name "<YOUR_NAME>"
  1. Install flux running the following command:
$ flux bootstrap github \
--kubeconfig /etc/rancher/k3s/k3s.yaml \
--owner=$GITHUB_USER \
--repository=developerweek-demo \
--branch=main \
--path=./clusters/mycluster \
--read-write-key \
--personal
  1. Clone the new repository
$ git clone https://github.com/$GITHUB_USER/developerweek-demo
$ cd developerweek-demo
  1. Create the new deployment
$ mkdir -p ./clusters/mycluster/manifests
$ cat << EOF > ./clusters/mycluster/manifests/led-app.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  creationTimestamp: null
  labels:
    app: led-app
  name: led-app
  namespace: default
spec:
  replicas: 1
  selector:
    matchLabels:
      app: led-app
  strategy: {}
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: led-app
    spec:
      containers:
      - image: sergioarmgpl/leds
        name: leds
        imagePullPolicy: Always
        env:
        - name: COLOR
          value: "OFF"
        securityContext:
          privileged: true
          capabilities:
            add: ["SYS_ADMIN"]
        volumeMounts:
        - mountPath: /dev
          name: dev-volume
      volumes:
      - name: dev-volume
        hostPath:
          path: /dev
          type: Directory
status: {}
EOF
  1. Commit and push the changes
$ git add -A
$ git commit -m "feat: added led deployment without turning on leds"
$ git push origin main
  1. Check until the deployment is up
$ kubectl rollout status deploy
$ kubectl rollout status deployment led-app
or
$ watch kubectl get deploy
  1. To check logs inside Flux when a change happens run
kubectl logs deploy/source-controller -n flux-system -f
  1. Edit the variable COLOR in the file clusters/mycluster/manifests/led-app.yaml to RED or GREEN, the commit and push the changes, and watch the led blinking in the color you set.

Note: Check the final result of this commands in the link: https://github.com/sergioarmgpl/developerweek-demo

developerweeklatam2023's People

Contributors

sergioarmgpl avatar

Watchers

 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.