# Kubernetes plugin for drone.io [](https://quay.io/repository/honestbee/drone-kubernetes)
Deploying containers across several deployments, eg in a scheduler-worker setup. Make sure your container `name` in your manifest is the same for each pod.
For debugging you firstly need to know if the kubectl inside the container is connecting to your cluster or not.
Easiest way to find this out to compare your [local kubectl config](https://kubernetes.io/docs/tasks/tools/install-kubectl/) `~/.kube/config` file with the generated one.
The generated kube conf will be
```yaml
apiVersion: v1
clusters:
- cluster:
server: ${kubernetes_server}
#possible insecure-skip-tls-verify: true or cert settings
name: default
contexts:
- context:
cluster: default
user: ${kubernetes_user}
name: default
current-context: default
kind: Config
preferences: {}
users:
- name: ${kubernetes_user}
user:
token: ${kubernetes_token}
```
After that the script calls the following script for every deployment+container combination:
```bash
kubectl -n ${namespace} set image deployment/${deployment} \
When using a version of kubernetes with RBAC (role-based access control)
enabled, you will not be able to use the default service account, since it does
not have access to update deployments. Instead, you will need to create a
custom service account with the appropriate permissions (`Role` and `RoleBinding`, or `ClusterRole` and `ClusterRoleBinding` if you need access across namespaces using the same service account).
As an example (for the `web` namespace):
```yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: drone-deploy
namespace: web
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: Role
metadata:
name: drone-deploy
namespace: web
rules:
- apiGroups: ["extensions"]
resources: ["deployments"]
verbs: ["get","list","patch","update"]
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding
metadata:
name: drone-deploy
namespace: web
subjects:
- kind: ServiceAccount
name: drone-deploy
namespace: web
roleRef:
kind: Role
name: drone-deploy
apiGroup: rbac.authorization.k8s.io
```
Once the service account is created, you can extract the `ca.cert` and `token`
parameters as mentioned for the default service account above:
```
kubectl -n web get secrets
# Substitute XXXXX below with the correct one from the above command
kubectl -n web get secret/drone-deploy-token-XXXXX -o yaml | egrep 'ca.crt:|token:'