A
A
Anton Bes2020-08-31 13:45:50
Kubernetes
Anton Bes, 2020-08-31 13:45:50

How to pass the namespace in which the container is running using curl?

There is a curl container that rises in a certain namespace, is it possible using curl to send information about the namespace in which this container rose in a notification using curl? And if so, what should curl look like to get namespace.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Bes, 2020-09-01
@BSH_EYES

I figured out that you can use environment variables to transfer the namespace to curl, passed it like this:

env:
    - name: NAMESPACE
      valueFrom:
          fieldRef:
            fieldPath: metadata.namespace

S
Stanislav Pugachev, 2020-08-31
@Stqs

Anton Bes
namespace can be available in /var/run/secrets/kubernetes.io/serviceaccount/namespace
but it seems to depend on the kubernetes version

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question