-
-
Save kmova/2096022aa4b886771a0886ba977f54b8 to your computer and use it in GitHub Desktop.
Run commands at Kubernetes *nodes* via `privileged` DaemonSet + `nsenter` hack, very useful for setups requiring base packages pre-installed at nodes. Please take a moment to understand what it does, and *don't* use it for *production*. Grab the logs with: kubectl logs -n kube-system -l k8s-app=node-custom-setup -c init-node
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
apiVersion: extensions/v1beta1 | |
kind: DaemonSet | |
metadata: | |
namespace: kube-system | |
name: node-custom-setup | |
labels: | |
k8s-app: node-custom-setup | |
annotations: | |
command: &cmd apt-get update -qy && apt-get install -qy tgt ceph-fs-common ceph-common xfsprogs | |
spec: | |
selector: | |
matchLabels: | |
k8s-app: node-custom-setup | |
template: | |
metadata: | |
labels: | |
k8s-app: node-custom-setup | |
spec: | |
hostNetwork: true | |
initContainers: | |
- name: init-node | |
command: | |
- nsenter | |
- --mount=/proc/1/ns/mnt | |
- -- | |
- sh | |
- -c | |
- *cmd | |
image: alpine:3.7 | |
securityContext: | |
privileged: true | |
hostPID: true | |
containers: | |
- name: wait | |
image: k8s.gcr.io/pause:3.1 | |
hostPID: true | |
hostNetwork: true | |
tolerations: | |
- effect: NoSchedule | |
key: node-role.kubernetes.io/master | |
updateStrategy: | |
type: RollingUpdate |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment