Skip to content

Instantly share code, notes, and snippets.

@harsh4870
Created June 10, 2022 06:54
Show Gist options
  • Save harsh4870/a23294f914da225bbdbe82b80770b306 to your computer and use it in GitHub Desktop.
Save harsh4870/a23294f914da225bbdbe82b80770b306 to your computer and use it in GitHub Desktop.
Daemonset configmap hostpath mounting
kind: ServiceAccount
metadata:
name: daemonset-access
namespace: default
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: cron-namespace-admin-rbac
subjects:
- kind: ServiceAccount
name: daemonset-access
namespace: default
roleRef:
kind: ClusterRole
name: cluster-admin
apiGroup: rbac.authorization.k8s.io
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: test
namespace: default
labels:
k8s-app: test
spec:
selector:
matchLabels:
name: test
template:
metadata:
labels:
name: test
spec:
serviceAccountName: daemonset-access
securityContext:
fsGroup: 1000
containers:
- command:
- bash
- -c
- mkdir -p /work-dir/filter_config ; cp /tmp/filter.conf /work-dir/filter_config ; /root/reload.sh; sleep 30000;
image: busybox
imagePullPolicy: IfNotPresent
name: test
volumeMounts:
- mountPath: /tmp/filter.conf
name: logs-filter
subPath: filter.conf
- mountPath: /root/reload.sh
name: sh-reload
subPath: reload.sh
- mountPath: /work-dir
name: logs-uma
- mountPath: /work-dir-ssh
name: do-node-ssh
imagePullSecrets:
- name: testsecret
- name: customsecret
volumes:
- configMap:
defaultMode: 420
name: logs-filter
name: logs-filter
- configMap:
defaultMode: 511
name: sh-reload
name: sh-reload
- hostPath:
path: /etc/monitoring-agent/conf.d
type: DirectoryOrCreate
name: logs-uma
- hostPath:
path: /home/opc/.ssh
type: DirectoryOrCreate
name: do-node-ssh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment