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!
Before Usage need to install helm
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh
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
# 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()
AWS Load Balance Controller V2 specific Namespace.
# 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,
namespace="kube-system"
)
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 1 or example repo 2 work with aws cdk.
License
Distributed under the Apache 2.0 license.
Metadata
Release files for cdk8s-aws-load-balancer-controller 2.3.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cdk8s-aws-load-balancer-controller-2.3.6.tar.gz | 609.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cdk8s_aws_load_balancer_controller-2.3.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.2 MB
Release files / cdk8s-aws-load-balancer-controller-2.3.6.tar.gz
| Download URL | cdk8s-aws-load-balancer-controller-2.3.6.tar.gz |
|---|---|
| Size | 609.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9291c770da148d9691983bb87f31dc1857c62b6b8640e17694c1622087b4de0c
|
|
BLAKE2b-256 checksum How to use checksums |
5d876e4335133052f83f774c0cea1029b2fb1ceb98af998fe4af7851df2282d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.7.10
|
Release files / cdk8s_aws_load_balancer_controller-2.3.6-py3-none-any.whl
| Download URL | cdk8s_aws_load_balancer_controller-2.3.6-py3-none-any.whl |
|---|---|
| Size | 608.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9e2c7fdb49d112eb43e11535ba0d80532eed428012137ba9874855c406a88608
|
|
BLAKE2b-256 checksum How to use checksums |
ad70990f2fcb6ef86918c34a4220197c60dccedccab94187b87821f80bdbbb5c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.7.10
|