$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

    View Slide

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

    View Slide

  3. @shahidh_k
    git push

    View Slide

  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

    View Slide

  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
    .git/hooks/pre-receive

    View Slide

  6. @shahidh_k
    Demo time
    (In case Gods are not kind enough today!)

    View Slide

  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

    View Slide

  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

    View Slide

  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

    View Slide

  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

    View Slide

  11. @shahidh_k
    Why Gitkube?
    git just works for AllTheThings™
    git checkout
    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.

    View Slide

  12. @shahidh_k
    Thanks for listening.
    Questions?

    View Slide