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
cmd := exec.Command("kubectl", "logs", "-f", "my-pod", "-n", "default") | |
stdout, err := cmd.StdoutPipe() | |
if err != nil { | |
panic(err) | |
} |
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
package main | |
import ( | |
"fmt" | |
"os/exec" | |
) |
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
err := clientset.CoreV1().Pods("default").Delete(ctx, "my-pod", metav1.DeleteOptions{}) | |
if err != nil { | |
panic(err) | |
} | |
fmt.Println("Pod deleted.") | |
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
err := clientset.CoreV1().Pods("default").Delete(ctx, "my-pod", metav1.DeleteOptions{}) | |
if err != nil { | |
panic(err) | |
} | |
fmt.Println("Pod deleted.") |
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
deployment := &appsv1.Deployment{ | |
ObjectMeta: metav1.ObjectMeta{ | |
Name: "my-deployment", | |
}, | |
Spec: appsv1.DeploymentSpec{ |
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 { |
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
package main | |
import ( | |
"flag" | |
"fmt" | |
"path/filepath" |
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
go get k8s.io/apimachinery@latest |
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
go get k8s.io/api@latest |
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
go get k8s.io/client-go@latest |