How to use secret in probes authorization header on kubernetes?

1.3k views Asked by At

I need to configure the probes in kubernetes. In my probes endpoints I use http and basic auth. Here is an example of my deployment.yml

livenessProbe:
 httpGet:
 path: /actuator/health/liveness
 port: 8080
 scheme: HTTP
 httpHeaders:
 - name: Authorization
 value: Basic dXNlcjpwYXNzd29yZA==

Is it possible to configure it to use the secret value in header authorization? As far as I know header must be 'user: password' encoded in base64, otherwise it won't work. I keep the user and password in my application's application.yml, the configMap for this project was created on the basis of application.yml. Is it possible to automatically retrieve user and password from configMap and add to base64 and assign to a variable or secrecy? or is there any possibility to keep user and password in secret and use this in probe? [I don't mean to keep 'user: password' already in base64 in secret type token, only basic auth '].

I will be very grateful for any answer.

1

There are 1 answers

0
acid_fuji On

Is it possible to automatically retrieve user and password from configMap and add to base64 and assign to a variable or secrecy?

Short answer is no. If you look into docs you will notice that Kubernetes does not have this functionality. All available options are listed in this Kubernetes API reference.

You will have to create a custom solution to make this functionality possible like write your own script that read that ConfigMap (e.g. curl API for that config).