drone-kubernetes/README.md

77 lines
2.8 KiB
Markdown
Raw Normal View History

# Kubernetes plugin for drone.io [![Docker Repository on Quay](https://quay.io/repository/honestbee/drone-kubernetes/status "Docker Repository on Quay")](https://quay.io/repository/honestbee/drone-kubernetes)
2017-01-13 10:07:48 +00:00
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
2017-01-17 10:12:14 +00:00
container: my-container
2017-01-13 10:07:48 +00:00
tag: ${DRONE_COMMIT_SHA:8}
2017-02-08 05:48:42 +00:00
Deploying several new containers, eg in a scheduler-worker setup. Make sure your container `name` in your manifest is the same for each pod.
2017-02-08 05:45:22 +00:00
pipeline:
deploy:
image: quay.io/honestbee/drone-kubernetes
deployment: [server-deploy, worker-deploy]
repo: myorg/myrepo
container: my-container
tag: ${DRONE_COMMIT_SHA:8}
2017-02-07 06:09:44 +00:00
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}
2017-02-20 10:20:47 +00:00
kubernetes_cert: ${KUBERNETES_CERT_STAGING}
2017-02-07 06:09:44 +00:00
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}
2017-02-20 10:20:47 +00:00
# notice: no tls verification will be done, warning will is printed
2017-02-07 06:09:44 +00:00
deployment: my-deployment
repo: myorg/myrepo
container: my-container
namespace: app
tag: ${DRONE_COMMIT_SHA:8}
when:
branch: [ master ]
2017-01-13 10:07:48 +00:00
## Required secrets
drone secret add --image=honestbee/drone-kubernetes \
your-user/your-repo KUBERNETES_SERVER https://mykubernetesapiserver
2017-02-20 10:20:47 +00:00
drone secret add --image=honestbee/drone-kubernetes \
your-user/your-repo KUBERNETES_CERT <base64 encoded CA.crt>
2017-01-13 10:07:48 +00:00
drone secret add --image=honestbee/drone-kubernetes \
your-user/your-repo KUBERNETES_TOKEN eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJrdWJ...
2017-02-20 10:20:47 +00:00
When using TLS Verification, ensure Server Certificate used by kubernetes API server
is signed for SERVER url ( could be a reason for failures if using aliases of kubernetes cluster )
2017-01-13 10:07:48 +00:00
## To do
Replace the current kubectl bash script with a go implementation.
### Special thanks
Inspired by [drone-helm](https://github.com/ipedrazas/drone-helm).