Skip to content

Instantly share code, notes, and snippets.

@hjacobs
Created January 13, 2017 08:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hjacobs/94e5543b37608e473c18d8bbeae193df to your computer and use it in GitHub Desktop.
Save hjacobs/94e5543b37608e473c18d8bbeae193df to your computer and use it in GitHub Desktop.
Add SSH key to CoreOS authorized_keys via Kubernetes host access
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: add-my-ssh-key
labels:
application: add-my-ssh-key
spec:
template:
metadata:
name: add-my-ssh-key
labels:
application: add-my-ssh-key
spec:
containers:
- name: shell
image: registry.opensource.zalan.do/stups/ubuntu:latest
command:
- /bin/bash
- -c
args:
- "curl https://even.stups.zalan.do/public-keys/hjacobs/sshkey.pub -o /host-root/home/core/.ssh/authorized_keys.d/hjacobs && cat /host-root/home/core/.ssh/authorized_keys.d/hjacobs >> /host-root/home/core/.ssh/authorized_keys; sleep 99999"
securityContext:
privileged: true
volumeMounts:
- mountPath: /host-root
name: host-root
volumes:
- name: host-root
hostPath:
path: /
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment