Skip to content

Instantly share code, notes, and snippets.

@HighwayofLife
Last active February 18, 2020 08:28
Show Gist options
  • Select an option

  • Save HighwayofLife/03b25802d9119c5ceb07572bab5dcb46 to your computer and use it in GitHub Desktop.

Select an option

Save HighwayofLife/03b25802d9119c5ceb07572bab5dcb46 to your computer and use it in GitHub Desktop.
Drone kube runner examples
---
# Source: drone/templates/deployment-runner.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: drone-kube-runner
namespace: pipeline
labels:
app: drone
chart: "drone-2.2.0"
release: "drone"
heritage: "Tiller"
component: kube-runner
spec:
selector:
matchLabels:
app: drone
release: "drone"
component: kube-runner
replicas: 1
template:
metadata:
annotations:
checksum/secrets: c17dfdf0fca5b5790d85f5f2bfcbf6da341b51bc6fc51412d964d835092671ba
labels:
app: drone
release: "drone"
component: kube-runner
spec:
serviceAccountName: drone-sa
containers:
- name: kube-runner
image: drone/drone-runner-kube:latest
imagePullPolicy: Always
env:
- name: DRONE_RPC_PROTO
value: "http"
- name: DRONE_RPC_HOST
value: drone.pipeline:80
- name: DRONE_RPC_SECRET
valueFrom:
secretKeyRef:
name: drone
key: secret
- name: DRONE_DEBUG
value: "true"
ports:
- name: http
containerPort: 3000
protocol: TCP
livenessProbe:
httpGet:
path: /
port: http
---
# Source: drone/templates/deployment-server.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: drone-server
namespace: pipeline
labels:
app: drone
chart: "drone-2.2.0"
release: "drone"
heritage: "Tiller"
component: server
spec:
selector:
matchLabels:
app: drone
release: "drone"
component: server
replicas: 1
template:
metadata:
annotations:
checksum/secrets: cc12ac3af35777874b882a51d82bf15cebeee226629b6d45c87455f75d020f71
prometheus.io/scrape: "true"
prometheus.io/port: "8000"
labels:
app: drone
release: "drone"
component: server
spec:
serviceAccountName: drone-sa
containers:
- name: server
image: "docker.io/drone/drone:1.6.1"
imagePullPolicy: IfNotPresent
env:
- name: DRONE_KUBERNETES_ENABLED
value: "true"
- name: DRONE_KUBERNETES_NAMESPACE
value: pipeline-jobs
- name: DRONE_KUBERNETES_SERVICE_ACCOUNT
value: drone-pipeline-sa
- name: DRONE_GIT_ALWAYS_AUTH
value: "true"
- name: DRONE_SERVER_HOST
value: "pipeline.<redacted>.net"
- name: DRONE_RPC_PROTO
value: "http"
- name: DRONE_RPC_HOST
value: drone.pipeline:80
- name: DRONE_SERVER_PROTO
value: https
- name: DRONE_USER_CREATE
value: username:davlewis,machine:false,admin:true
- name: DRONE_RPC_SECRET
valueFrom:
secretKeyRef:
name: drone
key: secret
- name: DRONE_AGENTS_DISABLED
value: "true"
- name: DRONE_DATABASE_DATASOURCE
value: "/var/lib/drone/drone.sqlite"
- name: DRONE_DATABASE_DRIVER
value: "sqlite3"
- name: DRONE_LOGS_DEBUG
value: "true"
- name: DRONE_USER_FILTER
value: "Pipeline"
- name: DRONE_GITHUB_CLIENT_ID
value: <redacted>
- name: DRONE_GITHUB_SERVER
value: https://<github-enterprise-server>
- name: DRONE_GITHUB_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: github-drone-oauth
key: client_secret
ports:
- name: http
containerPort: 80
protocol: TCP
- name: https
containerPort: 443
protocol: TCP
- name: grpc
containerPort: 9000
protocol: TCP
livenessProbe:
httpGet:
path: /
port: http
resources:
{}
volumeMounts:
- name: data
mountPath: /var/lib/drone
volumes:
- name: data
persistentVolumeClaim:
claimName: drone
@HighwayofLife
Copy link
Copy Markdown
Author

HighwayofLife commented Nov 7, 2019

The pod and container start, but then errors out and shuts down with the following in the error logs.

time="2019-11-07T00:00:12Z" level=info msg="starting the server" addr=":3000"
time="2019-11-07T00:00:12Z" level=info msg="successfully pinged the remote server"
time="2019-11-07T00:00:12Z" level=info msg="polling the remote server" capacity=100 endpoint="http://drone.pipeline:80" kind=pipeline type=kubernetes
time="2019-11-07T00:00:12Z" level=debug msg="request stage from remote server" thread=5
(last message repeated thousands of times)
...
time="2019-11-07T00:00:12Z" level=error msg="cannot request stage" error="not implemented" thread=5
...
time="2019-11-07T00:00:36Z" level=error msg="cannot request stage" error="not implemented" thread=11
time="2019-11-07T00:00:36Z" level=debug msg="request stage from remote server" thread=11
received signal, terminating process
...
time="2019-11-06T23:52:26Z" level=error msg="cannot request stage" error="context canceled" thread=71
...(repeated hundreds-thousands of time)...
time="2019-11-06T23:52:26Z" level=error msg="shutting down the server" error="http: Server closed"
drone-runner-kube: error: http: Server closed, try --help

@HighwayofLife
Copy link
Copy Markdown
Author

New logs:

time="2019-11-07T02:26:41Z" level=info msg="successfully pinged the remote server"
time="2019-11-07T02:26:41Z" level=info msg="polling the remote server" capacity=100 endpoint="http://drone.pipeline:80" kind=pipeline type=kubernetes
time="2019-11-07T02:26:41Z" level=debug msg="request stage from remote server" thread=100
...
POST /rpc/v2/stage HTTP/1.1
Host: drone.pipeline:80
User-Agent: Go-http-client/1.1
Content-Length: 93
X-Drone-Token: BKMXa1idK0X5IXHFjXmOw9lN
Accept-Encoding: gzip

{"kind":"pipeline","type":"kubernetes","os":"linux","arch":"amd64","variant":"","kernel":""}
time="2019-11-07T02:26:41Z" level=error msg="cannot request stage" error="not implemented" thread=100
time="2019-11-07T02:26:41Z" level=debug msg="request stage from remote server" thread=100
HTTP/1.1 500 Internal Server Error
Content-Length: 15
Cache-Control: no-cache, no-store, must-revalidate, private, max-age=0
Content-Type: text/plain; charset=utf-8
Date: Thu, 07 Nov 2019 02:26:41 GMT
Expires: Thu, 01 Jan 1970 00:00:00 UTC
Pragma: no-cache
X-Accel-Expires: 0
...

@bclermont
Copy link
Copy Markdown

I ported this to helm/charts

@bclermont
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment