Skip to main content

EKS Permissions

EKS actions require additional IAM configuration to create a cluster and access it.

  • EKS clusters need an associated service-linked EKS Role to access other AWS services. If this role does not already exist in the account, Create EKS Role provides instructions on how to create it.
  • The Target Account requires some privileges beyond PowerUserAccess to use EKS actions. Add Inline Policy to Target Account provides instructions on how to add these privileges. Using service-linked roles for Amazon EKS - Amazon EKS provides more detail on this requirement.

Managing Existing AWS EKS Cluster with Spot Connect

If you want to use an existing AWS EKS cluster, you must allow one of your Spot Connect Target Accounts (AWS account configured) to access the Kubernetes cluster. This can be done by associating a Target Account (AWS account configured) role ARN with a list of Kubernetes groups (i.e. system:masters, system:basic-user). Follow the instructions in Managing users or IAM roles for your cluster - Amazon EKS to complete this process.

Prerequisites

  • Configure the steps below in AWS IAM to run EKS Deploy Cluster action.
  • Copy the EKS cluster IAM role ARN to configure resource in EKS Permissions.

Step 1: Create IAM Role with EKS – Cluster Use-case

eks-1
  1. By default, AmazonEKSClusterPolicy policy is attached to the RoleAmazonEKSClusterPolicy policy that is attached to the role.

    eks-2
  2. Add Role name. In this example, the role name is EKS-Test-Cluster-Role.

    eks-3
  3. Update permissions of EKS-Test-Cluster-Role IAM role to create EKS Nodegroup.

  4. Attach AmazonEKSWorkerNodePolicy, AmazonEKS_CNI_Policy, AmazonEC2ContainerRegistryReadOnly policies to EKS role.

    eks-4
  5. In the Edit Trust Policy panel, run the following command to update trust relationship to include the Cloud Compute Capacity - Amazon EC2 - AWS service.

            {
    "Effect": "Allow",
    "Principal": {
    "Service": "ec2.amazonaws.com"
    },
    "Action": "sts:AssumeRole"
    }

Step 2: Update Target Account Role with Inline Policy

  1. Click Roles in the left menu and then click spotconnect-onboarding assume role.

  2. Click Add permissions and then click Create inline policy.

    eks-5

  3. In the Specify Permissions panel, click JSON on the top right and add the policy below with previously created IAM EKS-Test-Cluster-Role role ARN.

    {
    "Version":"2012-10-17",
    "Statement":[
    {
    "Effect":"Allow",
    "Action":[
    "iam:GetRole",
    "iam:PassRole",
    "iam:ListAttachedRolePolicies"
    ],
    "Resource":"arn:aws:iam::948274114318:role/EKS-Test-Cluster-Role"
    }
    ]
    }
  4. Provide a name for Inline policy and click Create Policy.

Step 3: Create IAM Role with EKS – Nodegroup Use-case

  1. In the Trusted entity type window, select ASW service and then EKS- Nodegroup.

  2. Click Next.

    eks-7

  3. In the Add permissions window, click Next.

    eks-8

Step 4: Update Target Account Role with Inline Policy

  1. In the Specify Permissions panel, click JSON in the top right and run the policy below with the IAM that was previously created: AWSServiceRoleForAmazonEKSNodegroup role ARN.

    {
    "Version": "2012-10-17",
    "Statement": [
    {
    "Effect": "Allow",
    "Action": [
    "iam:GetRole",
    "iam:PassRole"
    ],
    "Resource": "arn:aws:iam::948274114318:role/aws-service-role/eks-nodegroup.amazonaws.com/AWSServiceRoleForAmazonEKSNodegroup"
    }
    ]
    }
  2. Click Next.

    eks-9
  3. Provide a name for the Inline policy and click Create Policy.

    eks-9a

Configure the Resource

  1. In the left main menu, click Connect and click Settings.
  2. Under the Resources tab, select EKS Permissions.
  3. Click Add Resource to create a new resource instance.

Details needed to provide EKS Permissions to Spot Connect:

ParameterDescriptionRequired
Resource AliasAlias for EKS permissions resource instanceTrue
Target AccountAWS Target account for the EKS cluster roleTrue
Cluster Role ARNIAM Role ARN to be used for the EKS clusterTrue

Integration Actions

You can add these actions in the Spot Connect workflow builder as part of your workflow.

EKS Kubectl Run Command

This node runs a kubectl command on an AWS EKS cluster.

Input

ParameterDescriptionRequired
aliasTarget account alias to be used to perform EKS Kubectl Run command actionTrue
region_nameAWS region nameTrue
cluster_nameEKS Cluster nameTrue
argumentsCommand Line Arguments to pass to kubectlTrue
log_bucketS3 bucket for storing output from the commandFalse

Output

ParameterTypeDescription
output_strStringListIDs of filtered resources
output_jsonObjectThe output of kubectl operation
log_bucketStringS3 bucket where the output of the command is stored
log_keyStringS3 object where the output of the command is stored
execution_statusStringStatus of run (ie: S_OK / E_FAIL)

Action Example

Input

eks-10

Output

eks-11

EKS Get Namespaces

This node gets details of namespaces in AWS EKS cluster.

Input

ParameterDescriptionRequired
aliasTarget account alias to be used to perform EKS Get Namespaces actionTrue
cluster_nameEKS Cluster nameTrue
namespaceNamespace in EKS clusterTrue
region_nameAWS Region NameTrue

Output

ParameterTypeDescription
cluster_nameStringName of the AWS EKS cluster
namespacesMapListDetails of AWS EKS namespaces
countIntegerThe count of returned AWS EKS namespaces
execution_statusStringStatus of run (ie: S_OK / E_FAIL)

Action Example

Input

eks-12

Output

eks-13

EKS Get Deployments Name Only

This node fetches the list of deployments in an AWS EKS cluster.

Input

ParameterDescriptionRequired
aliasAWS target account for running the CloudFormation templateTrue
cluster_nameEKS Cluster nameTrue
region_nameAWS Region NameFalse
namespaceNamespace in EKS clusterFalse

Output

ParameterTypeDescription
cluster_nameStringName of the AWS EKS cluster
deployment_namesStringDetails of deployments
countIntegerThe count of returned deployments
execution_statusStringStatus of run (ie: S_OK / E_FAIL)

Action Example

Input

eks-14

Output

eks-15

EKS Get Nodes

This node gets the details of nodes for AWS EKS cluster.

Input

ParameterDescriptionRequired
aliasAWS target account for running the CloudFormation templateTrue
cluster_nameEKS Cluster nameTrue
nodeAWS Region NameFalse
region_nameNamespace in EKS clusterFalse

Output

ParameterTypeDescription
cluster_nameStringName of the AWS EKS cluster
nodesStringDetails of nodes
countIntegerThe count of returned nodes
execution_statusStringStatus of run (ie: S_OK / E_FAIL)

Action Example

Input

eks-16

Output

eks-17

EKS Get Pods

This node gets the details of pods for AWS EKS cluster.

Input

ParameterDescriptionRequired
aliasAWS target account for running the CloudFormation templateTrue
cluster_nameEKS Cluster nameTrue
region_nameAWS Region NameFalse
namespaceNamespace in EKS clusterFalse
pod_namePod name to filterFalse

Output

ParameterTypeDescription
cluster_nameStringName of the AWS EKS cluster
podsStringDetails of pods
countIntegerThe count of returned nodes
execution_statusStringStatus of run (ie: S_OK / E_FAIL)

Action Example

Input

eks-18

Output

eks-19

EKS Get Running Pods

This node gets the details of pods in running state for AWS EKS cluster.

Input

ParameterDescriptionRequired
aliasAWS target account for running the CloudFormation templateTrue
cluster_nameEKS Cluster nameTrue
region_nameAWS Region NameFalse
namespaceNamespace in EKS clusterFalse

Output

ParameterTypeDescription
cluster_nameStringName of the AWS EKS cluster
podsStringDetails of pods
countIntegerThe count of returned nodes
execution_statusStringStatus of run (ie: S_OK / E_FAIL)

Action Example

Input

eks-20

Output

eks-21

EKS Get Not Running Pods

This node gets the details of pods that are not in running state for AWS EKS cluster.

Input

ParameterDescriptionRequired
aliasAWS target account for running the CloudFormation templateTrue
cluster_nameEKS Cluster nameTrue
namespaceNamespace in EKS clusterFalse
region_nameAWS Region NameFalse

Output

ParameterTypeDescription
cluster_nameStringName of the AWS EKS cluster
pod_namesStringName of Pods not in running state
countIntegerThe count of returned nodes
execution_statusStringStatus of run (ie: S_OK / E_FAIL)

Action Example

Input

eks-22

Output

eks-23

EKS Get Pods Status

This node gets the status of pods in AWS EKS cluster.

Input

ParameterDescriptionRequired
aliasAWS target account for running the CloudFormation templateTrue
cluster_nameEKS Cluster nameTrue
namespaceNamespace in EKS clusterFalse
region_nameAWS Region NameFalse

Output

ParameterTypeDescription
cluster_nameStringName of the AWS EKS cluster
pods_statusMapListStatus of Pods
execution_statusStringStatus of run (ie: S_OK / E_FAIL)

Action Example

Input

eks-24

Output

eks-25

EKS Fetch Dead Pods

This node gets the dead pods from EKS cluster.

Input

ParameterDescriptionRequired
aliasAWS target account for running the CloudFormation templateTrue
cluster_nameEKS Cluster nameTrue
namespaceNamespace in EKS clusterFalse
region_nameAWS Region NameFalse

Output

ParameterTypeDescription
countIntegerCount of dead pods
cluster_nameStringName of the AWS EKS cluster
pod_namesStringListStatus of Pods
execution_statusStringStatus of run (ie: S_OK / E_FAIL)

Action Example

Input

eks-26

Output

eks-27

EKS Execute

This node executes the Kubernetes methods for these endpoints <https://github.com/kubernetes-client/python/blob/master/kubernetes/README.md>

Input

ParameterDescriptionRequired
aliasAWS target account for running the CloudFormation templateTrue
cluster_nameEKS Cluster nameTrue
function
payload
output_selector
region_nameNamespace in EKS clusterFalse
raw_outputAWS Region NameFalse

Output

ParameterTypeDescription
outputListList of resources created
cluster_nameStringName of the AWS EKS cluster
raw_outputStringListOutput of K8s executed method
execution_statusStringStatus of run (ie: S_OK / E_FAIL)

Action Example

Input

eks-28

Output

eks-29

EKS Copy Pod Logs

This node copies logs of Pod to AWS S3 bucket.

Input

ParameterDescriptionRequired
aliasAWS target account for running the CloudFormation templateTrue
cluster_nameEKS Cluster nameTrue
pod_namesList of pod names to fetch logsTrue
bucket_nameAWS S3 bucket to store pod logsTrue
region_nameAWS Region of EKS cluster and S3 bucketFalse
namespaceNamespace in EKS clusterFalse

Output

ParameterTypeDescription
cluster_nameStringName of the AWS EKS cluster
bucket_keysStringAWS S3 Bucket key where Pod logs are stored
execution_statusStringStatus of run (ie: S_OK / E_FAIL)

Action Example

Input

eks-30

Output

eks-31

EKS Deploy Cluster

This node creates an AWS EKS cluster in a selected AWS region.

Input

ParameterDescriptionRequired
eks_aliasEKS Permissions Resource AliasTrue
aliasAWS target account for deploying the EKS clusterTrue
role_arnIAM Role ARN to be used for the EKS clusterTrue
cluster_nameEKS cluster nameTrue
region_nameAWS region nameTrue
availability_zonesAWS Availability Zones for creating subnetsFalse
kubernetes_versionKubernetes Version to use for the cluster (default = latest)False
security_group_idsList of strings each containing a security group IdFalse
security_groupsSecurity groups to be used for worker nodes and control plane communicationFalse
subnet_idsExisting Subnet Ids to be usedFalse
subnet_cidrsList of Subnet CIDRs for creating subnetsFalse
vpc_idExisting VPC Id to be usedFalse
vpc_cidrCIDR to be used if creating a VPCFalse

Output

cluster_nameStringName of the AWS EKS cluster
cluster_statusStringAWS S3 Bucket key where Pod logs are stored
cluster_security_group_idStringStatus of run (ie: S_OK / E_FAIL)
kubernetes_versionStringThe deployed K8s version
security_group_idsStringListIds of security groups
subnet_idsStringListIds of subnets
vpc_idStringId of VPC
execution_statusStringStatus of run (ie: S_OK / E_FAIL)

Action Example

Input

eks-32

Output

eks-33

EKS Delete Pods

The pods to be deleted from AWS EKS cluster.

Input

ParameterDescriptionRequired
aliasAWS target account for running the CloudFormation templateTrue
cluster_nameEKS Cluster nameTrue
namespaceNamespace in EKS clusterTrue
pod_namename for the pod to be deletedFalse
labellabel filter for selecting specific podsFalse
region_nameAWS Region NameFalse

Output

ParameterTypeDescription
cluster_nameStringName of the AWS EKS cluster
execution_statusStringStatus of run (ie: S_OK / E_FAIL)

Action Example

Input

eks-34

Output

eks-35

EKS Check Nodes CPU Memory Usage

This node fetches the CPU and Memory usage of worker nodes in AWS EKS cluster.

Input

ParameterDescriptionRequired
aliasAWS target account for running the CloudFormation templateTrue
cluster_nameEKS Cluster nameTrue
region_nameAWS Region NameFalse

Output

ParameterTypeDescription
cluster_nameStringName of the AWS EKS cluster
nodesMapListList of pods with its CPU and Memory usage
execution_statusStringStatus of run (ie: S_OK / E_FAIL)

Action Example

Input

eks-36

Output

eks-37

EKS Check Pods CPU Memory Usage

This node fetches the CPU and Memory usage of pods in AWS EKS cluster.

Input

ParameterDescriptionRequired
aliasAWS target account for running the CloudFormation templateTrue
cluster_nameEKS Cluster nameTrue
region_nameAWS Region NameFalse
namespaceNamespace to fetch PodsFalse

Output

ParameterTypeDescription
cluster_nameStringName of the AWS EKS cluster
podsMapListList of pods with its CPU and Memory usage
execution_statusStringStatus of run (ie: S_OK / E_FAIL)

Action Example

Input

eks-38

Output

eks-39