Created
November 18, 2020 22:27
-
-
Save nithu0115/1fafe51a7028e9ce65c2ad36aad1ae13 to your computer and use it in GitHub Desktop.
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: apps/v1 | |
kind: DaemonSet | |
metadata: | |
name: ssm-agent | |
namespace: kube-system | |
labels: | |
k8s-app: ssm-agent | |
spec: | |
selector: | |
matchLabels: | |
name: ssm-agent | |
template: | |
metadata: | |
labels: | |
name: ssm-agent | |
spec: | |
hostNetwork: true | |
hostPID: true | |
containers: | |
- image: nithmu/ssm-agent:3.0.356.0 | |
name: ssm-agent | |
securityContext: | |
runAsUser: 0 | |
privileged: true | |
volumeMounts: | |
# Allows systemctl to communicate with the systemd running on the host | |
- name: dbus | |
mountPath: /var/run/dbus | |
- name: run-systemd | |
mountPath: /run/systemd | |
# Allows to peek into systemd units that are baked into the official EKS AMI | |
- name: etc-systemd | |
mountPath: /etc/systemd | |
# This is needed in order to fetch logs NOT managed by journald | |
# journallog is stored only in memory by default, so we need | |
# | |
# If all you need is access to persistent journals, /var/log/journal/* would be enough | |
# FYI, the volatile log store /var/run/journal was empty on my nodes. Perhaps it isn't used in Amazon Linux 2 / EKS AMI? | |
# See https://askubuntu.com/a/1082910 for more background | |
- name: var-log | |
mountPath: /var/log | |
- name: run | |
mountPath: /run | |
- name: usr-lib-systemd | |
mountPath: /usr/lib/systemd | |
- name: etc-machine-id | |
mountPath: /etc/machine-id | |
- name: etc-sudoers | |
mountPath: /etc/sudoers.d | |
volumes: | |
# for systemctl to systemd access | |
- name: dbus | |
hostPath: | |
path: /var/run/dbus | |
type: Directory | |
- name: run-systemd | |
hostPath: | |
path: /run/systemd | |
type: Directory | |
- name: etc-systemd | |
hostPath: | |
path: /etc/systemd | |
type: Directory | |
- name: var-log | |
hostPath: | |
path: /var/log | |
type: Directory | |
# var-run implies you also need this, because | |
# /var/run is a synmlink to /run | |
# sh-4.2$ ls -lah /var/run | |
# lrwxrwxrwx 1 root root 6 Nov 14 07:22 /var/run -> ../run | |
- name: run | |
hostPath: | |
path: /run | |
type: Directory | |
- name: usr-lib-systemd | |
hostPath: | |
path: /usr/lib/systemd | |
type: Directory | |
# Required by journalctl to locate the current boot. | |
# If omitted, journalctl is unable to locate host's current boot journal | |
- name: etc-machine-id | |
hostPath: | |
path: /etc/machine-id | |
type: File | |
# Avoid this error > ERROR [MessageGatewayService] Failed to add ssm-user to sudoers file: open /etc/sudoers.d/ssm-agent-users: no such file or directory | |
- name: etc-sudoers | |
hostPath: | |
path: /etc/sudoers.d | |
type: Directory |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment