Home > Blockchain >  How to get access to kubernetes cluster from containerized application running inside node hosted on
How to get access to kubernetes cluster from containerized application running inside node hosted on

Time:06-18

I am using kubernetes client library for c#. This method should ideally provide me with k8s config of the cluster it is running inside

var k8sConfig = KubernetesClientConfiguration.InClusterConfig();

Inside docker container when this run it gives

k8s.Autorest.HttpOperationException: Operation returned an invalid status code 'Forbidden'

Expected behaviour is to get cluster inside application so as to use its configmaps and secrets. Is there any other method to do this or are there any pre-requisites to use this method?

Please note: I am using token login from web UI for cluster dashboard

CodePudding user response:

If you really want to use the configmap values you can mount it to your pod as shown here.(same for secret) https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/ Then these would be available to your pod as env variables.

CodePudding user response:

https://github.com/kubernetes-client/csharp/discussions/891

I asked over github too, which was answered by moderators. And this is what we need to do here. Keep "clusterrolbinding" concept in mind.

  • Related