Difference between revisions of "Install SSM Agent on Amazon EKS worker nodes by using Kubernetes DaemonSet"

From wikieduonline
Jump to navigation Jump to search
 
(7 intermediate revisions by the same user not shown)
Line 3: Line 3:
  
  
 +
 +
cat << EOF > ssm_daemonset.yaml
 +
apiVersion: apps/v1
 +
kind: DaemonSet
 +
metadata:
 +
  labels:
 +
    [[k8s-app]]: ssm-installer
 +
  name: ssm-installer
 +
  namespace: kube-system
 +
spec:
 +
  selector:
 +
    matchLabels:
 +
      k8s-app: ssm-installer
 +
  template:
 +
    metadata:
 +
      labels:
 +
        k8s-app: ssm-installer
 +
    spec:
 +
      containers:
 +
      - name: sleeper
 +
        image: busybox
 +
        command: ['sh', '-c', 'echo I keep things running! && sleep 3600']
 +
      initContainers:
 +
      - image: amazonlinux
 +
        imagePullPolicy: Always
 +
        name: ssm
 +
        command: ["/bin/bash"]
 +
        args: ["-c","echo '* * * * * root yum install -y https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/linux_amd64/amazon-ssm-agent.rpm & rm -rf /etc/cron.d/ssmstart' > /etc/cron.d/ssmstart"]
 +
        securityContext:
 +
          allowPrivilegeEscalation: true
 +
        volumeMounts:
 +
        - mountPath: /etc/cron.d
 +
          name: cronfile
 +
        terminationMessagePath: /dev/termination-log
 +
        terminationMessagePolicy: File
 +
      volumes:
 +
      - name: cronfile
 +
        hostPath:
 +
          path: /etc/cron.d
 +
          type: Directory
 +
      dnsPolicy: ClusterFirst
 +
      restartPolicy: Always
 +
      schedulerName: default-scheduler
 +
      terminationGracePeriodSeconds: 30
 +
EOF
 +
 +
== Related ==
 +
* <code>[[AmazonSSMManagedInstanceCore]]</code>
 +
* <code>[[yum install]] -y https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/linux_amd64/amazon-ssm-agent.rpm</code>
 +
 +
== See also ==
 
* {{amazon-ssm-agent}}
 
* {{amazon-ssm-agent}}
 
* {{SSM}}
 
* {{SSM}}
 
* {{EKS}}
 
* {{EKS}}
 +
 +
[[Category:EKS]]

Latest revision as of 08:11, 21 September 2023


cat << EOF > ssm_daemonset.yaml
apiVersion: apps/v1
kind: DaemonSet
metadata:
  labels:
    k8s-app: ssm-installer
  name: ssm-installer
  namespace: kube-system
spec:
  selector:
    matchLabels:
      k8s-app: ssm-installer
  template:
    metadata:
      labels:
        k8s-app: ssm-installer
    spec:
      containers:
      - name: sleeper
        image: busybox
        command: ['sh', '-c', 'echo I keep things running! && sleep 3600']
      initContainers:
      - image: amazonlinux
        imagePullPolicy: Always
        name: ssm
        command: ["/bin/bash"]
        args: ["-c","echo '* * * * * root yum install -y https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/linux_amd64/amazon-ssm-agent.rpm & rm -rf /etc/cron.d/ssmstart' > /etc/cron.d/ssmstart"]
        securityContext:
          allowPrivilegeEscalation: true
        volumeMounts:
        - mountPath: /etc/cron.d
          name: cronfile
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
      volumes:
      - name: cronfile
        hostPath:
          path: /etc/cron.d
          type: Directory
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      terminationGracePeriodSeconds: 30
EOF

Related[edit]

See also[edit]

Advertising: