List EKS resources #4711
-
Is it possible to list eks cluster resources? I want to do the same as |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
Im not super familiar with kubectl, but to list all the clusters you can use the following code: package main
import (
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/eks"
)
func main() {
sess, err := session.NewSession(&aws.Config{
Region: aws.String("us-east-1"),
})
if err != nil {
panic(err)
}
client := eks.New(sess)
out, err := client.ListClusters(&eks.ListClustersInput{})
if err != nil {
panic(err)
}
fmt.Printf("there are %v clusters", len(out.Clusters))
}
// Output:
//there are 1 clusters Let me know if this helps, |
Beta Was this translation helpful? Give feedback.
-
Hello @RanVaknin , This is listing the clusters, I would like to list the resources inside the cluster. |
Beta Was this translation helpful? Give feedback.
-
Based on this doc, it is not possible to get resource information using the SDK.
For all intents and purposes the CLI and SDK work the same way, both auto-generated from the EKS API model. Since the EKS API does not have an operation to view resources on a cluster, it will not be available on the SDK. There's Let me know if theres anything else I can do to help. Thanks, |
Beta Was this translation helpful? Give feedback.
-
Hi @RanVaknin , thanks for the response. I was searching for libs that could help me handle k8s resources and thought this could help. |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
Hi @brunomiranda-hotmart ,
Based on this doc, it is not possible to get resource information using the SDK.
For all intents and purposes the CLI and SDK work the same way, both auto-generated from the EKS API model. Since the EKS API does not have an operation to view resources on a cluster, it will not be available on the SDK.
There's
DescribeCluster
but I don't think this will get you what you are looking for.Let me know if theres anything else I can do to help.