question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[aws-eks] reference a value returned through "kubectl get"

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
eladbcommented, 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:

const hostname = new KubernetesGet(this, 'HostName', {
  kind: 'ingress',
  query: '$.items[0].status.loadBalancer.ingress.[0].hostname'
});

// then you can just reference the value like this:
hostname.valueAsString
0reactions
zxkanecommented, 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:

const hostname = new KubernetesGet(this, 'HostName', {
  kind: 'ingress',
  query: '$.items[0].status.loadBalancer.ingress.[0].hostname'
});

// then you can just reference the value like this:
hostname.valueAsString

It’s exactly what this feature requests. It could be a feature to verify the status of resources deployed via CDK.

Read more comments on GitHub >

github_iconTop Results From Across the Web

describe-cluster — AWS CLI 1.27.37 Command Reference
Returns descriptive information about an Amazon EKS cluster. The API server endpoint and certificate authority data returned by this operation are required ...
Read more >
Creating or updating a kubeconfig file for an Amazon EKS ...
In this topic, you create a kubeconfig file for your cluster (or update an existing one). The kubectl command-line tool uses configuration information...
Read more >
Resolve the Kubernetes object access error in Amazon EKS
I receive the following error in Amazon Elastic Kubernetes ... The output returns the Amazon Resource Name (ARN) of the IAM user or...
Read more >
EKS: Get-EKSCluster Cmdlet | AWS Tools for PowerShell
Returns descriptive information about an Amazon EKS cluster. The API server endpoint and certificate authority data returned by this operation are required ...
Read more >
aws-cdk/aws-eks module - AWS Documentation
In addition, the library also supports defining Kubernetes resource manifests within EKS clusters. Table Of Contents. Quick Start; API Reference; Architectural ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found