cdk8s-aws-load-balancer-controller is an CDK8S construct library that provides AWS Alb Load Balancer Controller Configure.
Project description
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for cdk8s-aws-load-balancer-controller-2.2.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a552f5872ae2e5dcf540f0ae4951230bdca89f6976acccf7c1214fb4d563fb15 |
|
MD5 | 8cb4ca334e6aef0a7b343bf450267510 |
|
BLAKE2b-256 | dbf22b4f615a31e10a495b0d74a5dd884f13699adb97d90e915dc20b86533d58 |
Close
Hashes for cdk8s_aws_load_balancer_controller-2.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | db57e1301b2b26f63f9a9835f867997115f5b66cfd8728d59511738af10e26a3 |
|
MD5 | d80d56e9abb8b239d4c100e23f87fbc8 |
|
BLAKE2b-256 | 1b80a4c57ba369dab8d6aeec8f1f533b2d223cb6e3ca6ca8452958c6ee5fbd13 |