Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Gitkube - Build and deploy docker images to Kub...

Gitkube - Build and deploy docker images to Kubernetes using git push

Gitkube architecture and demo

Shahidh K Muhammed

May 01, 2018
Tweet

More Decks by Shahidh K Muhammed

Other Decks in Technology

Transcript

  1. Hasura We’re making it fast for developers to build their

    backends. 1. A fast, lightweight GraphQL engine on postgres 2. Easily deploy code on kubernetes with a git push
  2. Sample app app ├── Dockerfile ├── k8s.yaml └── src ├──

    app.py ├── requirements.txt └── server.py
  3. Typical dev/deployment workflow 1. Modify code 2. docker build -t

    “myapp:version” . 3. docker push “myapp:version” 4. kubectl --context=dev edit deployment myapp 5. Repeat
  4. Workflow with gitkube 1. Modify code 2. git commit -am

    “changes” 3. git push dev master 4. Repeat
  5. Setup for “git push dev master” 1. Install gitkube on

    your kubernetes cluster 2. Create a remote called “dev” which is configured to build a docker image and update a deployment.
  6. The dev remote 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
  7. The dev remote 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
  8. The dev remote 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
  9. The dev remote 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
  10. The dev remote 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
  11. Features 1. Update multiple deployments with a single remote 2.

    Configure multiple remotes with different permissions 3. Push images to a registry (required on multi node clusters) 4. Build and deploy based on webhook events (coming soon!) 5. Easy customisation of hooks - plugin your own steps (coming soon!)
  12. gitkube vs .. 1. Git based tooling. Every developer is

    familiar with git. 2. Quick iteration time when used on dev/staging clusters 3. Simple permission system based on public keys 4. Very small surface area. Can easily be replaced with more sophisticated CI/CD pipelines when moving to production.
  13. Demo • Gitkube • GitOps at Hasura: ◦ Deploying applications

    ◦ Changing subdomain ◦ Add a new domain ◦ Database migrations
  14. Your computer gitkubed (deployment,svc) Exposed externally SSH-key based auth deployment

    git push kube master Remote (custom resource) Which deployments to update? Which authorized-keys? kubectl ... remote.yaml
  15. Your computer gitkubed (deployment,svc) Exposed externally SSH-key based auth deployment

    git push kube master Remote (custom resource) Which deployments to update? Which authorized-keys? gitkube-controller (operator) Listen to changes, and transmit kubectl ... remote.yaml