Skip to content

Commit

Permalink
Merge pull request #2 from timoreimann/add-deployment-guide
Browse files Browse the repository at this point in the history
Add deployment guide
  • Loading branch information
timoreimann authored Apr 3, 2019
2 parents 77592e1 + 9589bee commit 61d6296
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ To increase the amount of logging, add `-v=3` as parameter.
- `make container`: create a Docker image (set the `VERSION` environment variable to choose a custom image tag)
- `make push`: push the Docker image

## Deploying

See [the deployment guide](/deploy/README.md).

## Releasing

1. Update the `VERSION` variable in the Makefile.
Expand Down
16 changes: 16 additions & 0 deletions deploy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Deployment

Deploying coredns-sidecar requires the following modifications to an existing CoreDNS installation:

1. add the sidecar to the CoreDNS deployment (see [this patch](coredns-deploy-patch.yml) that can be applied running `kubectl patch --namespace kube-system deploy coredns --patch "$(cat coredns-deploy-patch.yml)"`)
1. expand existing RBAC rules for CoreDNS to permit listing and watching nodes
1. amend the CoreDNS Corefile by a piece of configuration for the hosts plugin:

```
hosts /shared/hosts {
ttl 5
fallthrough
}
```

`fallthrough` is needed so that lookups which cannot be fulfilled by the hosts file get relayed to other resolution mechanisms provided by CoreDNS. `tls` can be adjusted per your own discretion.
35 changes: 35 additions & 0 deletions deploy/coredns-deploy-patch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
spec:
template:
spec:
containers:
- name: coredns
volumeMounts:
- mountPath: /shared
name: hostsfile
- args:
- -hostsfile
- /shared/hosts
image: timoreimann/coredns-sidecar:0.0.1
name: hostsfile-updater
resources:
limits:
memory: 100Mi
requests:
cpu: 100m
memory: 100Mi
volumeMounts:
- mountPath: /shared
name: hostsfile
initContainers:
# Use an init container to create an empty hosts file with proper file permissions. We need this because
# the sidecar implementation copies over the permissions from an existing file.
- name: hostsfile-creator
image: busybox:1.30.1
command: ['sh', '-c', 'touch /shared/hosts && chmod 755 /shared/hosts']
volumeMounts:
- mountPath: /shared
name: hostsfile
volumes:
- emptyDir: {}
name: hostsfile

0 comments on commit 61d6296

Please sign in to comment.