I am totally new to Kubernetes and what i need to achieve i need to make a call to specific api in my application to add new node to the Kubernetes cluster so i am looking for the best way to do so
Actually what I really need to have the ability to apply new deployment from an API in web app in docker way I need to start container dynamically when user hit my api
There’s a few things to unpack to allow your application to create new objects like a Deployment.
- You need to create a
- You need a
Rolethat defines the access allowed
- You need a
RoleBindingthat attaches the role to the account
- You need to attach the Service account to your pod.
ClusterRoles are cluster-wide access while
Roles are namespaced.
This topic is discussed in the RBAC and Configuring Service Accounts for Pods sections of the documentation (to name a couple). The Authorization Overview section is also worth a read depending on how in-depth you really want to go on this topic.
As for your application, I would recommend getting to know some of the Client Libraries.
If you need something example-wise to go off of, I wrote an application in bash that will delete pods to be recreated when configmaps are updated here. It uses a
ServiceAccount; as well as auto-mounts the API token to the pod. The script itself curls
api-server via DNS
I recommend using the client libraries instead of interfacing with the
thank u i really appreciate your help