Install Drone-Vm on kubernetes

To install Drone-vm on Kubernetes, you can follow these steps:

  1. Create a Kubernetes secret to hold your Drone server’s shared secret:
kubectl create secret generic drone-secret --from-literal=sharedsecret=<your shared secret>

Replace <your shared secret> with the shared secret you set during the Drone installation.

  1. Create a ConfigMap to hold your Drone-vm configuration:
kubectl create configmap drone-vm-config \
  --from-literal=DRONE_RPC_PROTO=https \
  --from-literal=DRONE_RPC_HOST=<your Drone server's IP address> \
  --from-literal=DRONE_RPC_SECRET=$(kubectl get secret drone-secret -o jsonpath="{.data.sharedsecret}" | base64 --decode) \
  --from-literal=DRONE_RUNNER_CAPACITY=2 \
  --from-literal=DRONE_RUNNER_NAME=runner-vm

Replace <your Drone server's IP address> with the IP address of your Drone server.

  1. Create a Deployment for Drone-vm:
apiVersion: apps/v1
kind: Deployment
metadata:
  name: drone-vm
spec:
  replicas: 1
  selector:
    matchLabels:
      app: drone-vm
  template:
    metadata:
      labels:
        app: drone-vm
    spec:
      containers:
        - name: drone-vm
          image: drone/drone-runner-vm:latest
          envFrom:
            - configMapRef:
                name: drone-vm-config
          volumeMounts:
            - name: docker-sock
              mountPath: /var/run/docker.sock
            - name: data
              mountPath: /data
      volumes:
        - name: docker-sock
          hostPath:
            path: /var/run/docker.sock
        - name: data
          hostPath:
            path: /var/lib/drone-runner-docker

This Deployment will create one replica of the Drone-vm container using the configuration from the ConfigMap.

  1. Apply the Deployment:
kubectl apply -f drone-vm.yaml

Replace drone-vm.yaml with the name of the YAML file that contains the Deployment configuration.

With these steps, you should have Drone-vm installed and running on your Kubernetes cluster.