Wie verwende ich benutzerdefinierte Benutzerdaten mit Amazon Linux 2023 EKS-Knoten?

Lesedauer: 2 Minute
0

Ich möchte benutzerdefinierte Benutzerdaten bereitstellen, wenn ich benutzerdefinierte Skripts, selbstverwaltete Knoten oder benutzerdefinierte Startvorlagen in Amazon Linux 2023-AMIs in Amazon Elastic Kubernetes Service (Amazon EKS) verwende.

Kurzbeschreibung

Amazon Linux 2023 verwendet den Initialisierungsprozess für den nodeadm-Knoten, der ein YAML-Konfigurationsschema verwendet. Weitere Informationen findest du im Abschnitt Vor dem Upgrade auf AL2023 in den Amazon EKS-optimierten Amazon Linux 2023-AMIs, die jetzt verfügbar sind.

Lösung

Füge den Benutzerdaten die erforderlichen Mindestparameter im folgenden Format hinzu:

MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="//"

--//
Content-Type: application/node.eks.aws

---
apiVersion: node.eks.aws/v1alpha1
kind: NodeConfig
spec:
  cluster:
    apiServerEndpoint: https://example.com
    certificateAuthority: Y2VydGlmaWNhdGVBdXRob3JpdHk=
    cidr: 10.100.0.0/16
    name: my-cluster

--//--

Ändere das Kubelet oder die enthaltenen Komponenten im folgenden Format:

MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="==MYBOUNDARY=="

--==MYBOUNDARY==
Content-Type: application/node.eks.aws

---
apiVersion: node.eks.aws/v1alpha1
kind: NodeConfig
spec:
  cluster:
    name: my-cluster
    apiServerEndpoint: https://example.com
    certificateAuthority: Y2VydGlmaWNhdGVBdXRob3JpdHk=
    cidr: 10.100.0.0/16
  kubelet:
    config:
      maxPods: 17
      clusterDNS:
      - 10.100.0.10
    flags:
    - "--node-labels=eks.amazonaws.com/nodegroup-image=ami-0cc04929616d2c6ba,eks.amazonaws.com/capacityType=ON_DEMAND,eks.amazonaws.com/nodegroup=al23"
   containerd: {}
  instance:
    localStorage: {}

--==MYBOUNDARY==--

Übergib benutzerdefinierte Skripts oder Befehle im folgenden Format:

MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="//"

--//
Content-Type: application/node.eks.aws

apiVersion: node.eks.aws/v1alpha1
kind: NodeConfig
spec:
  cluster:
    name: my-cluster
    apiServerEndpoint: https://example.com
    certificateAuthority: Y2VydGlmaWNhdGVBdXRob3JpdHk=
    cidr: 10.100.0.0/16

--//
Content-Type: text/x-shellscript; charset="us-ascii"

#!/bin/bash
echo "Hello AL2023!"
--//

Ähnliche Informationen

Amazon EKS AMI API-Referenz

AWS OFFICIAL
AWS OFFICIALAktualisiert vor einem Jahr