'In Kubernetes when creating Controller pod with In Cluster kubeapi configuration, I would like to talk to kubernetes the same way you do cmd line
I'm working on building a Kubernetes Controller Pod (or container) that accesses Kubernetes to modify the state of the Kubernetes cluster from within the Pod.
The issue is with the complexity of dealing with the Official Kubernetes Client Libraries. When you are working with Kubernetes on the command line, it is simple. You just create a kubernetes manifest file
# manifest.yaml
apiVersion: <some-version>
Kind: <some-kind>
metadata:
<some-metadata>
spec:
<some-spec>
Then you call kubectl create -f manifest.yaml
That to me is very simple way to work with Kubernetes.
I want to work with Kubernetes the same way when I am writing a Kubernetes controller Pod that accesses Kubernetes from inCluster config.
What I would like to do:
In my controller Pod I want to expose the Kubernetes api, and have a local install of kubectl in the container. I then want to generate any manifest as a text file in my controller code, and just run a simple kubectl create -f <file.yaml> on that manifest for it to create a resource in the cluster the Pod is running on.
How is this possible?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
