Warning Drone cloud stopped working for months and as the developers of Drone seemed to stop caring I'm no longer able to fully test this nor will I longer have any use of it, as a result I'm stopping all development of this plugin.
Drone plugin for deploying to kubernetes that allows injecting variables into the kubernetes YAML files & supports everything kubectl supports inside said YAML by running kubectl apply
for you.
This plugin can be used to deploy applications to a Kubernetes cluster, it will create\update the given kubernetes deployments/cron jobs/pods/etc as needed.
The below pipeline configuration demonstrates simple usage:
In addition to the
.drone.yml
file you will need to create ainjected_deployment.yaml
file that contains the kubernetes configuration you want to deploy.
kind: pipeline
type: docker
name: default
steps:
- name: kubernetes_deploy
image: naorlivne/drone-kubernetes-apply
settings:
kubernetes_token: my...vary...long...kube...token
kubernetes_api_host: https://mykubecluster.example.com
kubernetes_yaml_file: injected_deployment.yaml
Example configuration with values substitution:
kind: pipeline
type: docker
name: default
steps:
- name: kubernetes_deploy
image: naorlivne/drone-kubernetes-apply
settings:
kubernetes_token: my...vary...long...kube...token
kubernetes_api_host: https://mykubecluster.example.com
kubernetes_yaml_file: injected_deployment.yaml
my_image_tag: my_dynamic_image
In the injected_deployment.yaml
file (please note the $ before the PLUGIN_MY_IMAGE_TAG key):
{
...
"image": "myrepo/myimage:$PLUGIN_MY_IMAGE_TAG",
...
}
will result in:
{
...
"image": "myrepo/myimage:my_dynamic_image",
...
}
The kubernetes API server URL (no trailing slash should be used), alternately mount a kubeconfig into the container /root/.kube/config
The token used to auth against the kubernetes API, alternately mount a kubeconfig into the container /root/.kube/config
The kubernetes deployment configuration file location relative to the root folder of the repo, defaults to injected_deployment.yaml