Closed
Description
Provide a capability to reference values returned through kubectl get
, then the value could be used by other parts of application later.
Example:
const hostname = new KubernetesGet(this, 'HostName', {
kind: 'ingress',
query: '$.items[0].status.loadBalancer.ingress.[0].hostname',
wait: true // retry until the value becomes available
});
// then you can just reference the value like this:
hostname.valueAsString
Use Case
When orchestrating an application, the EKS cluster and resources created by k8s resource/helm chart are parts of the entire application.
For example, we deploy a helm chart with internal NLB/ALB ingress controller of a service. And the service exposed by EKS just is part of entire application(other services are be provided by ECS or EC2 auto scaling group).
We need the resource arn created by NLB/ALB ingress controller for entire application orchestration.
Proposed Solution
Other
- 👋 I may be able to implement this feature request⚠️ This feature might incur a breaking change
This is a 🚀 Feature Request
Activity
eladb commentedon Jun 22, 2020
We would need a more concrete example. Can you share some code?
zxkane commentedon Jun 22, 2020
There is an example to deploy Sonatype Nexus OSS on EKS.
I need the arn of the ALB created in the EKS in that stack if putting CloudFront in front of the alb.
eladb commentedon Jun 24, 2020
Can you please be more specific? Can you point me to the line of code where this is created and where you would expect to be able to obtain the ARN?
zxkane commentedon Jun 24, 2020
I'm using cluster.addChart to deploy the Helm chart sonatype-nexus, which deploys Nexus OSS with ingress using ALB. So an ALB will be created after the chart is deployed successfully.
It would be useful to add optional query parameters for
addChart
andaddResource
, the query parameters indicating the types of resource, names of resource, output format ofkubectl get
. And the output ofkubectl get
is treated as output of custom resource.Also it would be more flexible if adding new method
cluster.getResources
viakubectl get
. User can use the dependency of CFN resources to get the runtime value of K8S resources.For example, I would like to get hostname of ingress after deploying it,
eladb commentedon Jun 24, 2020
Okay, I think I understand the use case. Basically what you are looking for is a way to reference values returned from a
kubectl get
in your CDK app.I think the main problem with this, in k8s, is that most of the apply operations are asynchronous. This means that you would need to "wait" for the resource to stabilize before we can issue the query, but I guess this query operation can also have some sort of retry support.
So perhaps something like this:
[-]eks: get resource arn created by KubernetesResource or HelmChart[/-][+][EKS Feature] reference a value returned through "kubectl get"[/+]zxkane commentedon Jun 24, 2020
It's exactly what this feature requests. It could be a feature to verify the status of resources deployed via CDK.
feat(eks): ability to query runtime information from the cluster (#9535)
[-][EKS Feature] reference a value returned through "kubectl get"[/-][+][aws-eks] reference a value returned through "kubectl get"[/+]