Die vorliegende Übersetzung wurde maschinell erstellt. Im Falle eines Konflikts oder eines Widerspruchs zwischen dieser übersetzten Fassung und der englischen Fassung (einschließlich infolge von Verzögerungen bei der Übersetzung) ist die englische Fassung maßgeblich.
AWSSupport-TroubleshootEKSNetwork
Description
Das AWSSupport-TroubleshootEKSNetwork Runbook hilft Ihnen bei der Behebung von Netzwerkverbindungsproblemen in Containern, die in Amazon Elastic Kubernetes Service (Amazon EKS) -Clustern ausgeführt werden. Das Runbook erfasst je nach Zieltyp Rechen- und Netzwerkstatistiken von der Quelle und dem Ziel des Datenverkehrs.
Funktionsweise
Verwenden Sie dieses Runbook, um Probleme mit der Konnektivität zu den folgenden Zieltypen zu beheben:
POD: Ein weiterer Kubernetes Pod.
SERVICE: Ein Kubernetes Service.
IP: Eine interne oder externe IPv4/IPv6 Adresse des Clusters oder der Amazon VPC.
DNS: Ein Domainname, intern oder extern für den Cluster oder die Amazon VPC.
Wichtig
Zusätzlich zu den folgenden IAM-Berechtigungen AutomationAssumeRole müssen sie mithilfe der unterstützten Amazon EKS-API-Zugriffsmethoden Zugriff auf die Amazon EKS-Cluster haben. Für Cluster, die Zugriffseinträge verwenden, ist die AmazonEKSViewPolicy Zugriffsrichtlinie die erforderliche Mindestrichtlinie.
Führen Sie diese Automatisierung aus (Konsole)
Erforderliche IAM-Berechtigungen
Der AutomationAssumeRole Parameter erfordert die folgenden Aktionen, um das Runbook erfolgreich zu verwenden.
Dieses Runbook führt die AWSSupport-SetupK8sApiProxyForEKS und die AWSSupport-CollectEKSLinuxNodeStatistics untergeordneten Runbooks unter derselben Rolle aus. Sie AutomationAssumeRole müssen die folgenden Aktionen für das übergeordnete und das untergeordnete Runbook zulassen:
cloudformation:CreateStackcloudformation:DeleteStackcloudformation:DescribeStackResourcescloudformation:DescribeStackscloudformation:UpdateStackec2:CreateNetworkInterfaceec2:DeleteNetworkInterfaceec2:DescribeInstancesec2:DescribeNetworkInterfacesec2:DescribeRegionsec2:DescribeRouteTablesec2:DescribeSecurityGroupsec2:DescribeSubnetsec2:DescribeVpcPeeringConnectionsec2:DescribeVpcseks:DescribeClustereks:DescribeFargateProfileiam:AttachRolePolicyiam:CreateRoleiam:DeleteRoleiam:DeleteRolePolicyiam:DetachRolePolicyiam:GetRoleiam:PassRoleiam:PutRolePolicyiam:TagRoleiam:UntagRolelambda:CreateFunctionlambda:DeleteFunctionlambda:GetFunctionlambda:InvokeFunctionlambda:ListTagslambda:TagResourcelambda:UntagResourcelambda:UpdateFunctionCodelambda:UpdateFunctionConfigurationlogs:CreateLogGrouplogs:CreateLogStreamlogs:DeleteLogGrouplogs:DescribeLogGroupslogs:DescribeLogStreamslogs:ListTagsForResourcelogs:PutLogEventslogs:PutRetentionPolicylogs:TagResourcelogs:UntagResources3:GetBucketLocations3:GetObjects3:PutObjectssm:DescribeAutomationExecutionsssm:DescribeAutomationStepExecutionsssm:DescribeDocumentssm:DescribeInstanceInformationssm:GetAutomationExecutionssm:GetCommandInvocationssm:GetDocumentssm:ListCommandsssm:SendCommandssm:StartAutomationExecutionsts:GetCallerIdentitytag:GetResourcestag:TagResources
Die folgende Beispielrichtlinie zeigt die Berechtigungen mit den geringsten Rechten, die für die erforderlich sind. AutomationAssumeRole Ersetzen SieREGION, ACCOUNTID SOURCE_CLUSTER_NAMEDESTINATION_CLUSTER_NAME, und durch Ihre S3_BUCKET_NAME eigenen Werte:
{ "Version": "2012-10-17", "Statement": [ { "Sid": "EKSClusterAccess", "Effect": "Allow", "Action": "eks:DescribeCluster", "Resource": [ "arn:aws:eks:REGION:ACCOUNTID:cluster/SOURCE_CLUSTER_NAME", "arn:aws:eks:REGION:ACCOUNTID:cluster/DESTINATION_CLUSTER_NAME" ] }, { "Sid": "EKSFargateProfileAccess", "Effect": "Allow", "Action": "eks:DescribeFargateProfile", "Resource": [ "arn:aws:eks:REGION:ACCOUNTID:fargateprofile/SOURCE_CLUSTER_NAME/*", "arn:aws:eks:REGION:ACCOUNTID:fargateprofile/DESTINATION_CLUSTER_NAME/*" ] }, { "Sid": "EC2DescribePermissions", "Effect": "Allow", "Action": [ "ec2:DescribeInstances", "ec2:DescribeRegions", "ec2:DescribeRouteTables", "ec2:DescribeVpcs", "ec2:DescribeVpcPeeringConnections", "ec2:DescribeSubnets" ], "Resource": "*", "Condition": { "StringEquals": { "aws:RequestedRegion": "REGION" } } }, { "Sid": "SSMAutomationExecution", "Effect": "Allow", "Action": [ "ssm:StartAutomationExecution", "ssm:GetAutomationExecution", "ssm:DescribeAutomationExecutions", "ssm:DescribeAutomationStepExecutions" ], "Resource": "arn:aws:ssm:REGION:ACCOUNTID:automation-execution/*" }, { "Sid": "SSMDocumentAccess", "Effect": "Allow", "Action": [ "ssm:DescribeDocument", "ssm:GetDocument" ], "Resource": [ "arn:aws:ssm:REGION:ACCOUNTID:document/AWSSupport-TroubleshootEKSNetwork", "arn:aws:ssm:REGION:ACCOUNTID:document/AWSSupport-SetupK8sApiProxyForEKS", "arn:aws:ssm:REGION:ACCOUNTID:document/AWSSupport-CollectEKSLinuxNodeStatistics", "arn:aws:ssm:REGION:*:document/AWS-RunShellScript" ] }, { "Sid": "SSMRunCommandOnNodes", "Effect": "Allow", "Action": [ "ssm:SendCommand", "ssm:GetCommandInvocation" ], "Resource": [ "arn:aws:ec2:REGION:ACCOUNTID:instance/*", "arn:aws:ssm:REGION:*:document/AWS-RunShellScript" ], "Condition": { "StringEquals": { "aws:ResourceTag/eks:cluster-name": [ "SOURCE_CLUSTER_NAME", "DESTINATION_CLUSTER_NAME" ] } } }, { "Sid": "S3TroubleshootingAssets", "Effect": "Allow", "Action": [ "s3:GetObject", "s3:PutObject" ], "Resource": "arn:aws:s3:::S3_BUCKET_NAME/AWSSupport-CollectEKSLinuxNodeStatistics/*" }, { "Sid": "S3BucketLocation", "Effect": "Allow", "Action": "s3:GetBucketLocation", "Resource": "arn:aws:s3:::S3_BUCKET_NAME" }, { "Sid": "LambdaK8sProxyManagement", "Effect": "Allow", "Action": [ "lambda:CreateFunction", "lambda:DeleteFunction", "lambda:GetFunction", "lambda:InvokeFunction", "lambda:UpdateFunctionCode", "lambda:UpdateFunctionConfiguration" ], "Resource": "arn:aws:lambda:REGION:ACCOUNTID:function:Automation-K8sProxy-*" }, { "Sid": "CloudFormationK8sProxyStack", "Effect": "Allow", "Action": [ "cloudformation:CreateStack", "cloudformation:DeleteStack", "cloudformation:DescribeStacks", "cloudformation:DescribeStackResources" ], "Resource": "arn:aws:cloudformation:REGION:ACCOUNTID:stack/AWSSupport-SetupK8sApiProxyForEKS-*/*" }, { "Sid": "IAMForK8sProxyLambdaRole", "Effect": "Allow", "Action": [ "iam:CreateRole", "iam:DeleteRole", "iam:GetRole", "iam:AttachRolePolicy", "iam:DetachRolePolicy", "iam:PutRolePolicy", "iam:DeleteRolePolicy" ], "Resource": "arn:aws:iam::ACCOUNTID:role/Automation-K8sProxy-Role-*" }, { "Sid": "IAMPassRoleToLambda", "Effect": "Allow", "Action": "iam:PassRole", "Resource": "arn:aws:iam::ACCOUNTID:role/Automation-K8sProxy-Role-*", "Condition": { "StringEquals": { "iam:PassedToService": "lambda.amazonaws.com" } } }, { "Sid": "CloudWatchLogsForK8sProxy", "Effect": "Allow", "Action": [ "logs:CreateLogGroup", "logs:CreateLogStream", "logs:PutLogEvents", "logs:DeleteLogGroup" ], "Resource": "arn:aws:logs:REGION:ACCOUNTID:log-group:/aws/lambda/Automation-K8sProxy-*" }, { "Sid": "ResourceTaggingForStackLookup", "Effect": "Allow", "Action": "tag:GetResources", "Resource": "*", "Condition": { "StringEquals": { "aws:RequestedRegion": "REGION" } } }, { "Sid": "STSCallerIdentity", "Effect": "Allow", "Action": "sts:GetCallerIdentity", "Resource": "*" } ] }
Zusätzlich zur vorherigen Beispielrichtlinie, die AWSSupport-TroubleshootEKSNetwork nur Berechtigungen für gewährt, benötigen Sie zusätzliche Richtlinien für die Ausführung von AWSSupport-SetupK8sApiProxyForEKS und durch untergeordnete Runbooks. AWSSupport-CollectEKSLinuxNodeStatistics Die folgenden Beispielrichtlinien gelten für diese Dokumente:
Erforderliche Berechtigungen fürAWSSupport-SetupK8sApiProxyForEKS:
{ "Version":"2012-10-17", "Statement": [ { "Action": [ "tag:GetResources", "tag:TagResources", "ec2:CreateNetworkInterface", "ec2:DescribeNetworkInterfaces", "ec2:DescribeRouteTables", "ec2:DescribeSecurityGroups", "ec2:DescribeSubnets", "ec2:DescribeVpcs", "ec2:DeleteNetworkInterface", "eks:DescribeCluster", "iam:GetRole", "cloudformation:DescribeStacks", "logs:DescribeLogGroups", "logs:DescribeLogStreams", "lambda:GetFunction", "lambda:ListTags", "logs:ListTagsForResource" ], "Resource": "*", "Effect": "Allow", "Sid": "AllowActionsWithoutConditions" }, { "Condition": { "StringEquals": { "aws:RequestTag/AWSSupport-SetupK8sApiProxyForEKS": "true" } }, "Action": "iam:CreateRole", "Resource": [ "arn:aws:iam::ACCOUNTID:role/Automation-K8sProxy*" ], "Effect": "Allow", "Sid": "AllowCreateRoleWithRequiredTag" }, { "Condition": { "StringEquals": { "aws:ResourceTag/AWSSupport-SetupK8sApiProxyForEKS": "true" } }, "Action": [ "iam:DeleteRole", "iam:TagRole", "iam:UntagRole" ], "Resource": [ "arn:aws:iam::ACCOUNTID:role/Automation-K8sProxy*" ], "Effect": "Allow", "Sid": "IAMActions" }, { "Condition": { "StringEquals": { "aws:ResourceTag/AWSSupport-SetupK8sApiProxyForEKS": "true" }, "StringLike": { "iam:PolicyARN": [ "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", "arn:aws:iam::aws:policy/service-role/AWSLambdaVPCAccessExecutionRole" ] } }, "Action": [ "iam:AttachRolePolicy", "iam:DetachRolePolicy" ], "Resource": [ "arn:aws:iam::ACCOUNTID:role/Automation-K8sProxy*" ], "Effect": "Allow", "Sid": "AttachRolePolicy" }, { "Condition": { "StringEquals": { "aws:ResourceTag/AWSSupport-SetupK8sApiProxyForEKS": "true" } }, "Action": [ "lambda:CreateFunction", "lambda:DeleteFunction", "lambda:TagResource", "lambda:UntagResource", "lambda:UpdateFunctionCode" ], "Resource": "arn:aws:lambda:REGION:ACCOUNTID:function:Automation-K8sProxy*", "Effect": "Allow", "Sid": "LambdaActions" }, { "Condition": { "StringEquals": { "aws:ResourceTag/AWSSupport-SetupK8sApiProxyForEKS": "true" } }, "Action": [ "cloudformation:CreateStack", "cloudformation:DeleteStack", "cloudformation:UpdateStack" ], "Resource": "arn:aws:cloudformation:REGION:ACCOUNTID:stack/AWSSupport-SetupK8sApiProxyForEKS*", "Effect": "Allow", "Sid": "CloudFormationActions" }, { "Condition": { "StringEquals": { "aws:ResourceTag/AWSSupport-SetupK8sApiProxyForEKS": "true" } }, "Action": [ "logs:CreateLogGroup", "logs:CreateLogStream", "logs:PutLogEvents", "logs:PutRetentionPolicy", "logs:TagResource", "logs:UntagResource" ], "Resource": [ "arn:aws:logs:REGION:ACCOUNTID:log-group:/aws/lambda/Automation-K8sProxy*", "arn:aws:logs:REGION:ACCOUNTID:log-group:/aws/lambda/Automation-K8sProxy*:*" ], "Effect": "Allow", "Sid": "LogsActions" }, { "Condition": { "StringLikeIfExists": { "iam:PassedToService": "lambda.amazonaws.com" } }, "Action": [ "iam:PassRole" ], "Resource": [ "arn:aws:iam::ACCOUNTID:role/Automation-K8sProxy-Role*" ], "Effect": "Allow", "Sid": "PassRoleToLambda" } ] }
Berechtigungen erforderlich fürAWSSupport-CollectEKSLinuxNodeStatistics:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:GetAccountPublicAccessBlock" ], "Resource": "*" }, { "Effect": "Allow", "Action": [ "s3:GetBucketPublicAccessBlock", "s3:GetBucketAcl", "s3:GetBucketPolicyStatus", "s3:GetBucketLocation", "s3:GetEncryptionConfiguration" ], "Resource": "arn:aws:s3:::S3_BUCKET_NAME" }, { "Effect": "Allow", "Action": [ "s3:PutObject" ], "Resource": "arn:aws:s3:::S3_BUCKET_NAME/*" }, { "Effect": "Allow", "Action": [ "ssm:DescribeInstanceInformation" ], "Resource": "*" }, { "Effect": "Allow", "Action": [ "ssm:SendCommand" ], "Resource": [ "arn:aws:ssm:*:*:document/AWS-RunShellScript", "arn:aws:ec2:*:ACCOUNTID:instance/*" ] }, { "Effect": "Allow", "Action": [ "ssm:GetCommandInvocation" ], "Resource": "*" }, { "Effect": "Allow", "Action": [ "ec2:DescribeInstances" ], "Resource": "*" } ] }
Anleitungen
-
Öffnen Sie
AWSSupport-TroubleshootEKSNetworkim Systems Manager unter Dokumente. -
Wählen Sie Automatisierung ausführen.
-
Geben Sie für die Eingabeparameter Folgendes ein:
-
AutomationAssumeRole (Fakultativ):
Der ARN der IAM-Rolle, die es Systems Manager Automation ermöglicht, die Aktionen in Ihrem Namen auszuführen. Wenn keine Rolle angegeben ist, verwendet Systems Manager Automation Ihre Berechtigungen, um dieses Runbook auszuführen.
-
S3BucketName (Erforderlich):
Amazon S3-Bucket-Name für das Hochladen von Ressourcen zur Fehlerbehebung.
-
SourceClusterName (Erforderlich):
Name des Amazon EKS-Quell-Clusters für die Fehlerbehebung.
-
SourcePodName (Erforderlich):
Name des Kubernetes Quell-Pods, der die Netzwerkverbindung initiiert.
-
SourcePodNamespace (Erforderlich):
Namespace, in dem sich der Kubernetes Quell-Pod befindet.
-
DestinationType (Erforderlich):
Art des Ziels der Netzwerkverbindung. Gültige Werte:
POD,SERVICE,IPoderDNS. -
ConnectionProtocol (Erforderlich):
Protokoll für die Netzwerkverbindung. Gültige Werte:
tcp,udpodersctp. -
DestinationPort (Erforderlich):
Der Port des Ziels der Netzwerkverbindung.
-
DestinationClusterName (Fakultativ):
Der Name des Amazon EKS-Zielclusters (erforderlich für die POD- und SERVICE-Zieltypen).
-
DestinationPodName (Fakultativ):
Der Name des Kubernetes Ziel-Pods (erforderlich für den POD-Zieltyp).
-
DestinationPodNamespace (Fakultativ):
Namespace, in dem sich der Kubernetes Ziel-Pod befindet (erforderlich für den POD-Zieltyp).
-
DestinationServiceName (Optional):
Der Name des Kubernetes Zieldienstes (erforderlich für den Zieltyp SERVICE).
-
DestinationServiceNamespace (Fakultativ):
Namespace, in dem sich der Kubernetes Zieldienst befindet (erforderlich für den SERVICE-Zieltyp).
-
DestinationIpAddress (Optional):
IPv4- oder IPv6-Zieladresse (für den IP-Zieltyp erforderlich).
-
DestinationDnsName (Fakultativ):
Ziel-DNS-Name (erforderlich für den DNS-Zieltyp).
-
-
Wählen Sie Ausführen.
-
Die Automatisierung beginnt. Überwachen Sie den Ausführungsstatus auf der Registerkarte Ausführungen.
-
Das Dokument führt die folgenden Schritte automatisch aus:
-
ValidateTroubleshootingParameters:Überprüft die Eingabeparameter, die für die Problembehandlung erforderlich sind, z. B. ob der Cluster existiert.
-
SetupAuthProxyForSourceEKSCluster:Führt das
AWSSupport-SetupK8sApiProxyForEKSDokument aus, um eine Lambda-Funktion einzurichten, um Amazon EKS-API-Aufrufe auf dem Amazon EKS-Quell-Cluster durchzuführen. -
BranchOnDestinationProxySetupRequired:Legt anhand des Zieltyps fest, ob
SetupK8sApiProxyForEKSfür einen Zielcluster ausgeführt werden soll. -
SetupAuthProxyForDestinationEKSCluster:Führt bei Bedarf das
AWSSupport-SetupK8sApiProxyForEKSDokument aus, um eine Lambda-Funktion für den Amazon EKS-Zielcluster einzurichten. -
CollectSourcePodData:Sammelt und validiert die Informationen des Quell-Pods.
-
BranchOnSourcePodComputeEngine:Verzweigt, ob der Kubernetes Quell-Pod auf Amazon EC2 läuft, um Linux-Statistiken für den Knoten zu sammeln.
-
CollectSourceLinuxNodeStatistics:Wenn der Quell-Pod auf Amazon EC2 läuft, führt das
AWSSupport-CollectEKSLinuxNodeStatisticsDokument aus, um Linux-Statistiken vom Knoten des Kubernetes Quell-Pods abzurufen. -
CollectDestinationData:Sammelt und validiert die Zielinformationen.
-
BranchOnDestinationResults:Verzweigt, ob der Kubernetes Ziel-Pod auf Amazon EC2 läuft, um Linux-Statistiken für den Knoten zu sammeln.
-
CollectDestinationLinuxNodeStatistics:Wenn der Ziel-Pod auf Amazon EC2 läuft, führt das
AWSSupport-CollectEKSLinuxNodeStatisticsDokument aus, um Linux-Statistiken vom Amazon EKS-Zielknoten abzurufen. -
CleanupAuthProxyForSourceEKSCluster:Führt das
AWSSupport-SetupK8sApiProxyForEKSDokument mithilfe des Cleanup-Vorgangs aus, um die für den Quell-Cluster erstellten Ressourcen zu bereinigen. -
CleanupAuthProxyForDestinationEKSCluster:Führt das
AWSSupport-SetupK8sApiProxyForEKSDokument gegebenenfalls mithilfe des Cleanup-Vorgangs aus, um die für den Zielcluster erstellten Ressourcen zu bereinigen. -
GenerateReport:Generiert einen Bericht für den Ablauf der Problembehandlung.
-
-
Nach Abschluss der Automatisierung finden Sie im Abschnitt Ausgaben die Ausführungsergebnisse.
Referenzen
Systems Manager Automation
Weitere Informationen finden Sie unter Eine Automatisierung ausführen.
Weitere Informationen finden Sie unter Automatisierung einrichten.
Weitere Informationen finden Sie unter Unterstützung von Automatisierungsworkflows
.