Go to file
Vincent De Smet dae5ad67d9 Update Dockerfile to Best Practices:
- Version pinning on Base Image
- COPY is preferred over ADD
- apk -U will leave index in image, use `--no-cache` to avoid storing repo index
- curl kubectl directly to final destination
- Change entrypoint instead of running `sh -c bash -c /bin/update.sh`
2017-02-20 17:53:03 +08:00
Dockerfile Update Dockerfile to Best Practices: 2017-02-20 17:53:03 +08:00
README.md Update readme 2017-02-08 13:48:42 +08:00
update.sh Read CA base64 encoded from env 2017-02-20 17:30:53 +08:00

README.md

Kubernetes plugin for drone.io

This plugin allows to update a Kubernetes deployment.

Usage

This pipeline will update the my-deployment deployment with the image tagged DRONE_COMMIT_SHA:8

pipeline:
    deploy:
        image: quay.io/honestbee/drone-kubernetes
        deployment: my-deployment
        repo: myorg/myrepo
        container: my-container
        tag: ${DRONE_COMMIT_SHA:8}

Deploying several new containers, eg in a scheduler-worker setup. Make sure your container name in your manifest is the same for each pod.

pipeline:
    deploy:
        image: quay.io/honestbee/drone-kubernetes
        deployment: [server-deploy, worker-deploy]
        repo: myorg/myrepo
        container: my-container
        tag: ${DRONE_COMMIT_SHA:8}

This more complex example demonstrates how to deploy to several environments based on the branch, in a app namespace

pipeline:
    deploy-staging:
        image: quay.io/honestbee/drone-kubernetes
        kubernetes_server: ${KUBERNETES_SERVER_STAGING}
        kubernetes_token: ${KUBERNETES_TOKEN_STAGING}
        deployment: my-deployment
        repo: myorg/myrepo
        container: my-container
        namespace: app
        tag: ${DRONE_COMMIT_SHA:8}
        when:
            branch: [ staging ]

    deploy-prod:
        image: quay.io/honestbee/drone-kubernetes
        kubernetes_server: ${KUBERNETES_SERVER_PROD}
        kubernetes_token: ${KUBERNETES_TOKEN_PROD}
        deployment: my-deployment
        repo: myorg/myrepo
        container: my-container
        namespace: app
        tag: ${DRONE_COMMIT_SHA:8}
        when:
            branch: [ master ]

Required secrets

drone secret add --image=honestbee/drone-kubernetes \
    your-user/your-repo KUBERNETES_SERVER https://mykubernetesapiserver


drone secret add --image=honestbee/drone-kubernetes \
    your-user/your-repo KUBERNETES_TOKEN eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJrdWJ...

To do

Replace the current kubectl bash script with a go implementation.

Special thanks

Inspired by drone-helm.