Created
June 25, 2025 18:46
-
-
Save lovemycodesnippets/39e479490370114f444f0384d1e52142 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pods, err := clientset.CoreV1().Pods("default").List(ctx, metav1.ListOptions{}) | |
if err != nil { | |
panic(err) | |
} | |
for _, pod := range pods.Items { | |
fmt.Println("Pod:", pod.Name) | |
} | |
deployments, err := clientset.AppsV1().Deployments("default").List(ctx, metav1.ListOptions{}) | |
if err != nil { | |
panic(err) | |
} | |
for _, deploy := range deployments.Items { | |
fmt.Println("Deployment:", deploy.Name) | |
} | |
services, err := clientset.CoreV1().Services("default").List(ctx, metav1.ListOptions{}) | |
if err != nil { | |
panic(err) | |
} | |
for _, svc := range services.Items { | |
fmt.Println("Service:", svc.Name) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment