Skip to main content

cdk8s-aws-load-balancer-controller is an CDK8S construct library that provides AWS Alb Load Balancer Controller Configure.

Project description

NPM version PyPI version Release

Downloads npm PyPI

cdk8s-aws-load-balancer-controller

cdk8s aws load balancer controller constructs for cdk8s

This project was formerly known as "CDK AWS ALB Ingress Controller", I just rename it to be "CDK AWS Load Balancer Controller".

Basic implementation of a aws load balancer controller construct for cdk8s. Contributions are welcome!

Usage

npm i cdk8s-aws-load-balancer-controller
npm i cdk8s
or
yarn add cdk8s-aws-load-balancer-controller
yarn add cdk8s

AWS Load Balance Controller V1

# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
from cdk8s import App, Chart
from constructs import Construct
from cdk8s_aws_load_balancer_controller import AlbIngressController

class MyChart(Chart):
    def __init__(self, scope, name):
        super().__init__(scope, name)
        AlbIngressController(self, "albingresscntroller",
            cluster_name="EKScluster"
        )
app = App()
MyChart(app, "testcdk8s")
app.synth()

AWS Load Balance Controller V2

only support install in default namespace now!!!

# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
from cdk8s import App, Chart
from cdk8s_aws_load_balancer_controller import AwsLoadBalancerController
import constructs as constructs

class MyChart(Chart):
    def __init__(self, scope, name, *, clusterName):
        super().__init__(scope, name)
        alb = AwsLoadBalancerController(self, "alb",
            cluster_name=cluster_name,
            create_service_account=False
        )
        self.deployment_name = alb.deployment_name
        self.deployment_name_space = alb.namespace
app = App()
MyChart(app, "testcdk8s")
app.synth()

Featrue For Add IAM Policy.

  • For IRSA add IAM Policy version 1.
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
# CDK APP like eks_cluster.ts
from cdk8s_aws_load_balancer_controller import AwsLoadBalancePolicy, VersionsLists
import aws_cdk.aws_eks as eks
cluster = eks.Cluster(self, "MyK8SCluster",
    default_capacity=0,
    masters_role=cluster_admin,
    version=eks.KubernetesVersion.V1_18
)

alb_service_account = cluster.add_service_account("alb-ingress-controller",
    name="alb-ingress-controller",
    namespace="kube-system"
)
# will help you add policy to IAM Role .
AwsLoadBalancePolicy.add_policy(VersionsLists.AWS_LOAD_BALANCER_CONTROLLER_POLICY_V1, alb_service_account)
  • For IRSA add IAM Policy version 2.
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
# CDK APP like eks_cluster.ts
from cdk8s_aws_load_balancer_controller import AwsLoadBalancePolicy, VersionsLists
import aws_cdk.aws_eks as eks
cluster = eks.Cluster(self, "MyK8SCluster",
    default_capacity=0,
    masters_role=cluster_admin,
    version=eks.KubernetesVersion.V1_18
)

sa = eks.ServiceAccount(self, "albserviceaccount",
    cluster=cluster,
    name="aws-load-balancer-controller"
)
AwsLoadBalancePolicy.add_policy(VersionsLists.AWS_LOAD_BALANCER_CONTROLLER_POLICY_V2, sa)

Also can see example repo

License

Distributed under the Apache 2.0 license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cdk8s-aws-load-balancer-controller-1.0.5.tar.gz (587.5 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file cdk8s-aws-load-balancer-controller-1.0.5.tar.gz.

File metadata

  • Download URL: cdk8s-aws-load-balancer-controller-1.0.5.tar.gz
  • Upload date:
  • Size: 587.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.9

File hashes

Hashes for cdk8s-aws-load-balancer-controller-1.0.5.tar.gz
Algorithm Hash digest
SHA256 e5a122fb1e6d605ebf421e60be842030899e48e4f1a36aec71b5ff60297659cd
MD5 a1ef998b569d0d52993c37580d4a7526
BLAKE2b-256 2290a4ce96da25f41c8a00cebbbdc68c624363353673d57f265a946fb519ee48

See more details on using hashes here.

File details

Details for the file cdk8s_aws_load_balancer_controller-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: cdk8s_aws_load_balancer_controller-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 586.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.9

File hashes

Hashes for cdk8s_aws_load_balancer_controller-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 89accf0a53d32b6f2560fe99d7e6b9715bf17b40af70c977497a815aadbb66c8
MD5 e23d7aae5844f357c898fd6f7c30107d
BLAKE2b-256 f07a2267c0705ccca469defdf20861ccae8797dfd78867c82364c9595b530e2f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page