$30 off During Our Annual Pro Sale. View Details »

Gitkube: Continuous Deployment to Kubernetes using Git Push

Gitkube: Continuous Deployment to Kubernetes using Git Push

A short demo on Gitkube and it's architecture as presented at ContainerDays 2018, Hamburg.

Shahidh K Muhammed

June 20, 2018
Tweet

More Decks by Shahidh K Muhammed

Other Decks in Technology

Transcript

  1. @shahidh_k Continuous Deployment to Kubernetes using Git Push

  2. @shahidh_k Guten Morgen! I’m Shahidh GraphQL on Postgres

  3. @shahidh_k git push

  4. @shahidh_k Before <> After $ git push dev master $

    docker build -t registry.com/my-image:my-tag $ docker push registry.com/my-image:my-tag $ kubectl set image deployment/my-deployment container=registry.com/my-image:my-tag
  5. @shahidh_k Git hooks client-side > pre-push Exit can abort push

    server-side > pre-receive Exit can abort push > post-receive Cannot abort push Executable files in .git/hooks/ named <hook> .git/hooks/pre-receive
  6. @shahidh_k Demo time (In case Gods are not kind enough

    today!)
  7. @shahidh_k Architecture - Git remote agent on the cluster. Pre-receive

    hook: - Build docker image - Apply to k8s deployment - Configuration: - SSH keys - Dockerfile path - Sync configuration changes with the git-remote agent - K8s Operator git-remote k8s :: deployment,svc Exposed externally SSH-key based auth deployment $ git push dev master CRD configuration k8s :: CRD Deployments to update authorized-keys Dockerfile path controller k8s :: operator Apply changes $ kubectl ... remote.yaml </> your computer Kubernetes cluster
  8. @shahidh_k remote.yaml apiVersion: gitkube.sh/v1alpha1 kind: Remote metadata: name: dev spec:

    authorizedKeys: - "ssh-rsa your-ssh-public-key" deployments: - name: app containers: - name: app path: app dockerfile: app/Dockerfile Kubernetes CRD
  9. @shahidh_k remote.yaml apiVersion: gitkube.sh/v1alpha1 kind: Remote metadata: name: dev spec:

    authorizedKeys: - "ssh-rsa your-ssh-public-key" deployments: - name: app containers: - name: app path: app dockerfile: app/Dockerfile Access control
  10. @shahidh_k remote.yaml apiVersion: gitkube.sh/v1alpha1 kind: Remote metadata: name: dev spec:

    authorizedKeys: - "ssh-rsa your-ssh-public-key" deployments: - name: app containers: - name: app path: app dockerfile: app/Dockerfile app ├── Dockerfile ├── k8s.yaml └── src ├── app.py ├── requirements.txt └── server.py
  11. @shahidh_k Why Gitkube? git just works for AllTheThings™ git checkout

    <commit> git push dev my-branch:master • git push to apply changes to kubernetes objects. • Every developer is familiar with git. • Quick iteration time when used on dev/staging clusters • Simple permission system based on public keys • Very small surface area. Can easily be replaced with more sophisticated CI/CD pipelines when moving to production.
  12. @shahidh_k Thanks for listening. Questions?