A simple Go package wrapping kubectl
invocations. It only depends on the stdlib and overall has a minimal footprint.
First, make sure you've got the package installed, for example, in a global scope:
$ go get -u github.com/mhausenblas/kubecuddler
A minimal usage example would look like the following:
package main
import (
"fmt"
"github.com/mhausenblas/kubecuddler"
)
func main() {
res, _ := kubecuddler.Kubectl(true, true, "", "get", "po,svc")
fmt.Println(res)
}
This produces an output like so:
Another example, this time with a failing command, looks like this:
package main
import (
"fmt"
"github.com/mhausenblas/kubecuddler"
)
func main() {
res, _ := kubecuddler.Kubectl(true, true, "", "get", "depl")
fmt.Println(res)
}
The above produces an output akin to: