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.6.tar.gz (598.1 kB view details)

Uploaded Source

Built Distribution

File details

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

File metadata

  • Download URL: cdk8s-aws-load-balancer-controller-1.0.6.tar.gz
  • Upload date:
  • Size: 598.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.7.10

File hashes

Hashes for cdk8s-aws-load-balancer-controller-1.0.6.tar.gz
Algorithm Hash digest
SHA256 8933f76119718d4f158c5e99fe8293dfa4dad508daa88b3c7f9cf6882c9bcaac
MD5 5c9a48f3d9de66a3feb0e367df45cb55
BLAKE2b-256 bcbf1616afdabc418765cc1a499a5b7f1be985d0839e87c5347ad312f55332fa

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cdk8s_aws_load_balancer_controller-1.0.6-py3-none-any.whl
  • Upload date:
  • Size: 596.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.7.10

File hashes

Hashes for cdk8s_aws_load_balancer_controller-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 02e93f8a1f151608a368434e15a944797250941f63bdd93e86624ee894e77b6d
MD5 1292be2116a1562427eab6e96f97e97b
BLAKE2b-256 60553f498bc9f19cfd8037cb89d7abccb81b37ab8d3637d5267dbb7c57703907

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