View a markdown version of this page

AWSSupport-TroubleshootEKSNetwork - AWS Systems Manager オートメーションランブックリファレンス

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

AWSSupport-TroubleshootEKSNetwork

説明

AWSSupport-TroubleshootEKSNetwork ランブックは、Amazon Elastic Kubernetes Service (Amazon EKS) クラスターで実行されているコンテナのネットワーク接続に関する問題のトラブルシューティングに役立ちます。ランブックは、送信先タイプに応じて、トラフィックソースと送信先からコンピューティング統計とネットワーク統計を収集します。

仕組み

このランブックを使用して、次の送信先タイプへの接続をトラブルシューティングします。

  • POD: Kubernetes 別のポッド。

  • サービス: Kubernetesサービス。

  • IP: クラスターまたは Amazon VPC の内部または外部の IPv4/IPv6 アドレス。

  • DNS: クラスターまたは Amazon VPC の内部または外部のドメイン名。

重要

AutomationAssumeRole は、次の IAM アクセス許可に加えて、サポートされている Amazon EKS API アクセス方法を使用して Amazon EKS クラスターにアクセスできる必要があります。アクセスエントリを使用するクラスターの場合、AmazonEKSViewPolicyアクセスポリシーは最低限必要なポリシーです。

このオートメーションを実行する (コンソール)

必要な IAM 許可

AutomationAssumeRole パラメータでは、ランブックを正常に使用するために、次のアクションが必要です。

このランブックは、 AWSSupport-SetupK8sApiProxyForEKSおよび AWSSupport-CollectEKSLinuxNodeStatistics 子ランブックを同じロールで実行します。では、親ランブックと子ランブックに対して次のアクションを許可AutomationAssumeRoleする必要があります。

  • cloudformation:CreateStack

  • cloudformation:DeleteStack

  • cloudformation:DescribeStackResources

  • cloudformation:DescribeStacks

  • cloudformation:UpdateStack

  • ec2:CreateNetworkInterface

  • ec2:DeleteNetworkInterface

  • ec2:DescribeInstances

  • ec2:DescribeNetworkInterfaces

  • ec2:DescribeRegions

  • ec2:DescribeRouteTables

  • ec2:DescribeSecurityGroups

  • ec2:DescribeSubnets

  • ec2:DescribeVpcPeeringConnections

  • ec2:DescribeVpcs

  • eks:DescribeCluster

  • eks:DescribeFargateProfile

  • iam:AttachRolePolicy

  • iam:CreateRole

  • iam:DeleteRole

  • iam:DeleteRolePolicy

  • iam:DetachRolePolicy

  • iam:GetRole

  • iam:PassRole

  • iam:PutRolePolicy

  • iam:TagRole

  • iam:UntagRole

  • lambda:CreateFunction

  • lambda:DeleteFunction

  • lambda:GetFunction

  • lambda:InvokeFunction

  • lambda:ListTags

  • lambda:TagResource

  • lambda:UntagResource

  • lambda:UpdateFunctionCode

  • lambda:UpdateFunctionConfiguration

  • logs:CreateLogGroup

  • logs:CreateLogStream

  • logs:DeleteLogGroup

  • logs:DescribeLogGroups

  • logs:DescribeLogStreams

  • logs:ListTagsForResource

  • logs:PutLogEvents

  • logs:PutRetentionPolicy

  • logs:TagResource

  • logs:UntagResource

  • s3:GetBucketLocation

  • s3:GetObject

  • s3:PutObject

  • ssm:DescribeAutomationExecutions

  • ssm:DescribeAutomationStepExecutions

  • ssm:DescribeDocument

  • ssm:DescribeInstanceInformation

  • ssm:GetAutomationExecution

  • ssm:GetCommandInvocation

  • ssm:GetDocument

  • ssm:ListCommands

  • ssm:SendCommand

  • ssm:StartAutomationExecution

  • sts:GetCallerIdentity

  • tag:GetResources

  • tag:TagResources

次のポリシー例は、 に必要な最小特権のアクセス許可を示していますAutomationAssumeRoleREGIONACCOUNTID、、SOURCE_CLUSTER_NAMEDESTINATION_CLUSTER_NAME、 を独自の値S3_BUCKET_NAMEに置き換えます。

{ "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": "*" } ] }

に対するアクセス許可AWSSupport-TroubleshootEKSNetworkのみを提供する前述のポリシーの例に加えて、 AWSSupport-SetupK8sApiProxyForEKSおよび の子ランブック実行には追加のポリシーが必要ですAWSSupport-CollectEKSLinuxNodeStatistics。次のポリシー例は、これらのドキュメントに適用されます。

に必要なアクセス許可AWSSupport-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" } ] }

に必要なアクセス許可AWSSupport-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": "*" } ] }

指示

  1. ドキュメントの Systems Manager AWSSupport-TroubleshootEKSNetworkで を開きます。

  2. [Execute automation (自動化の実行)] を選択してください。

  3. 入力パラメータには、次のように入力します。

    • AutomationAssumeRole(オプション):

      Systems Manager Automation がユーザーに代わってアクションを実行できるようにする IAM ロールの ARN。ロールが指定されていない場合、Systems Manager Automation はアクセス許可を使用してこのランブックを実行します。

    • S3BucketName (必須):

      トラブルシューティングアセットをアップロードするための Amazon S3 バケット名。

    • SourceClusterName (必須):

      トラブルシューティングするソース Amazon EKS クラスターの名前。

    • SourcePodName (必須):

      ネットワーク接続を開始するソースKubernetesポッドの名前。

    • SourcePodNamespace (必須):

      ソースKubernetesポッドが存在する名前空間。

    • DestinationType (必須):

      ネットワーク接続先のタイプ。有効な値: PODSERVICEIP、または DNS

    • ConnectionProtocol (必須):

      ネットワーク接続のプロトコル。有効な値: tcpudp、または sctp

    • DestinationPort (必須):

      ネットワーク接続の送信先のポート。

    • DestinationClusterName (オプション):

      送信先 Amazon EKS クラスター名 (POD および SERVICE 送信先タイプに必要)。

    • DestinationPodName (オプション):

      送信先ポッドの名前 (POD Kubernetes 送信先タイプに必須)。

    • DestinationPodNamespace (オプション):

      送信先ポッドが存在する名前空間 (POD Kubernetes 送信先タイプに必須)。

    • DestinationServiceName (オプション):

      送信先Kubernetesサービスの名前 (SERVICE 送信先タイプに必須)。

    • DestinationServiceNamespace (オプション):

      送信先Kubernetesサービスが存在する名前空間 (SERVICE 送信先タイプに必須)。

    • DestinationIpAddress (オプション):

      送信先 IPv4 または IPv6 アドレス (IP 送信先タイプに必要)。

    • DestinationDnsName (オプション):

      送信先 DNS 名 (DNS 送信先タイプに必須)。

  4. [実行] を選択してください。

  5. 自動化が開始されます。Executions タブで実行ステータスをモニタリングします。

  6. ドキュメントは、以下のステップを自動的に実行します。

    • ValidateTroubleshootingParameters:

      クラスターが存在するかどうかなど、トラブルシューティングに必要な入力パラメータを検証します。

    • SetupAuthProxyForSourceEKSCluster:

      AWSSupport-SetupK8sApiProxyForEKS ドキュメントを実行して Lambda 関数をセットアップし、ソース Amazon EKS クラスターで Amazon EKS API コールを行います。

    • BranchOnDestinationProxySetupRequired:

      送信先タイプに基づいて、送信先クラスターSetupK8sApiProxyForEKSに対して を実行するかどうかを決定します。

    • SetupAuthProxyForDestinationEKSCluster:

      必要に応じて、 はAWSSupport-SetupK8sApiProxyForEKSドキュメントを実行して、送信先の Amazon EKS クラスターの Lambda 関数を設定します。

    • CollectSourcePodData:

      ソースポッドの情報を収集して検証します。

    • BranchOnSourcePodComputeEngine:

      ソースポッドが Amazon EC2 Kubernetes で実行され、ノードの Linux 統計情報を収集するかどうかを分岐します。

    • CollectSourceLinuxNodeStatistics:

      ソースポッドが Amazon EC2 で実行されている場合、 はAWSSupport-CollectEKSLinuxNodeStatisticsドキュメントを実行して、ソースポッドのノードから Linux Kubernetes 統計を取得します。

    • CollectDestinationData:

      送信先情報を収集して検証します。

    • BranchOnDestinationResults:

      レプリケート先ポッドが Amazon EC2 Kubernetes で実行され、ノードの Linux 統計情報を収集するかどうかを分岐します。

    • CollectDestinationLinuxNodeStatistics:

      レプリケート先ポッドが Amazon EC2 で実行されている場合、 はAWSSupport-CollectEKSLinuxNodeStatisticsドキュメントを実行して、レプリケート先 Amazon EKS ノードから Linux 統計を取得します。

    • CleanupAuthProxyForSourceEKSCluster:

      クリーンアップオペレーションを使用してAWSSupport-SetupK8sApiProxyForEKSドキュメントを実行し、ソースクラスター用に作成されたリソースをクリーンアップします。

    • CleanupAuthProxyForDestinationEKSCluster:

      必要に応じて、 はクリーンアップオペレーションを使用してAWSSupport-SetupK8sApiProxyForEKSドキュメントを実行し、送信先クラスター用に作成されたリソースをクリーンアップします。

    • GenerateReport:

      トラブルシューティングフローのレポートを生成します。

  7. 自動化が完了したら、出力セクションで実行結果を確認します。

リファレンス

Systems Manager Automation