Skip to content
v2.276.0

KubectlProviderOptions Struct ​

Options for creating the kubectl provider - a lambda function that executes kubectl and helm against the cluster.

Example ​

ts
import { KubectlV37Layer } from '@aws-cdk/lambda-layer-kubectl-v37';

const cluster = new eks.Cluster(this, 'hello-eks', {
  version: eks.KubernetesVersion.V1_37,
  kubectlProviderOptions: {
    kubectlLayer: new KubectlV37Layer(this, 'kubectl'),
    environment: {
        'http_proxy': 'http://proxy.myproxy.com',
    },
  }
});
python
from aws_cdk.lambda_layer_kubectl_v37 import KubectlV37Layer


cluster = eks.Cluster(self, "hello-eks",
    version=eks.KubernetesVersion.V1_37,
    kubectl_provider_options=eks.KubectlProviderOptions(
        kubectl_layer=KubectlV37Layer(self, "kubectl"),
        environment={
            "http_proxy": "http://proxy.myproxy.com"
        }
    )
)
java
import software.amazon.awscdk.cdk.lambdalayer.kubectl.v37.KubectlV37Layer;


Cluster cluster = Cluster.Builder.create(this, "hello-eks")
        .version(KubernetesVersion.V1_37)
        .kubectlProviderOptions(KubectlProviderOptions.builder()
                .kubectlLayer(new KubectlV37Layer(this, "kubectl"))
                .environment(Map.of(
                        "http_proxy", "http://proxy.myproxy.com"))
                .build())
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
using Amazon.CDK.LambdaLayer.KubectlV37;


var cluster = new Cluster(this, "hello-eks", new ClusterProps {
    Version = KubernetesVersion.V1_37,
    KubectlProviderOptions = new KubectlProviderOptions {
        KubectlLayer = new KubectlV37Layer(this, "kubectl"),
        Environment = new Dictionary<string, string> {
            { "http_proxy", "http://proxy.myproxy.com" }
        }
    }
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
import "github.com/cdklabs/awscdk-kubectl-go/kubectlv37"


cluster := eks.NewCluster(this, jsii.String("hello-eks"), &ClusterProps{
	Version: eks.KubernetesVersion_V1_37(),
	KubectlProviderOptions: &KubectlProviderOptions{
		KubectlLayer: kubectlv37.NewKubectlV37Layer(this, jsii.String("kubectl")),
		Environment: map[string]*string{
			"http_proxy": jsii.String("http://proxy.myproxy.com"),
		},
	},
})

Properties ​

awscliLayeroptionalILayerVersionawscli_layeroptionalILayerVersionawscliLayeroptionalILayerVersionAwscliLayeroptionalILayerVersionAwscliLayeroptionalILayerVersion#
An AWS Lambda layer that contains the `aws` CLI.

Default: If not defined, a default layer will be used containing the AWS CLI 2.x.

environmentoptional{ [key: string]: string }environmentoptionaltyping.Mapping[str, str]environmentoptionalMap<String, String>EnvironmentoptionalIDictionary<string, string>Environmentoptional*map[string]*string#
Custom environment variables when running `kubectl` against this cluster.

Default: No custom environment variables

kubectlLayerILayerVersionkubectl_layerILayerVersionkubectlLayerILayerVersionKubectlLayerILayerVersionKubectlLayerILayerVersionrequired#
An AWS Lambda layer that includes `kubectl` and `helm`.
memoryoptionalSizememoryoptionalSizememoryoptionalSizeMemoryoptionalSizeMemoryoptionalSize= 1024#
The amount of memory allocated to the kubectl provider's lambda function.
privateSubnetsoptionalISubnet[]private_subnetsoptionaltyping.List[ISubnet]privateSubnetsoptionalList<ISubnet>PrivateSubnetsoptionalISubnet[]PrivateSubnetsoptional*[]ISubnet#
Subnets to host the `kubectl` compute resources.

Default: the k8s is accessible publicly

If not specified, the k8s endpoint is expected to be accessible publicly.

removalPolicyoptionalRemovalPolicyremoval_policyoptionalRemovalPolicyremovalPolicyoptionalRemovalPolicyRemovalPolicyoptionalRemovalPolicyRemovalPolicyoptionalRemovalPolicy= RemovalPolicy.DESTROY#
The removal policy applied to the custom resource that provides kubectl.
notes

The removal policy controls what happens to the resource if it stops being managed by CloudFormation. This can happen in one of three situations:

  • The resource is removed from the template, so CloudFormation stops managing it
  • A change to the resource is made that requires it to be replaced, so CloudFormation stops managing it
  • The stack is deleted, so CloudFormation stops managing all resources in it
roleoptionalIRoleroleoptionalIRoleroleoptionalIRoleRoleoptionalIRoleRoleoptionalIRole#
An IAM role that can perform kubectl operations against this cluster.

Default: if not specified, the default role created by a lambda function will be used.

The role should be mapped to the system:masters Kubernetes RBAC role.

This role is directly passed to the lambda handler that sends Kube Ctl commands to the cluster.

securityGroupoptionalISecurityGroupsecurity_groupoptionalISecurityGroupsecurityGroupoptionalISecurityGroupSecurityGroupoptionalISecurityGroupSecurityGroupoptionalISecurityGroupdeprecated#
Use `securityGroups` instead.

Default: If not specified, the k8s endpoint is expected to be accessible publicly.

securityGroupsoptionalISecurityGroup[]security_groupsoptionaltyping.List[ISecurityGroup]securityGroupsoptionalList<ISecurityGroup>SecurityGroupsoptionalISecurityGroup[]SecurityGroupsoptional*[]ISecurityGroup#
Security groups to use for `kubectl` execution.

Default: If not specified, the k8s endpoint is expected to be accessible publicly.