Hi All , Is there a way by which we can use the env variable as the port number . . .

Md. Raise Azam:
Hi All ,
Is there a way by which we can use the env variable as the port number which has been defined in the pod ?

How can we refer in the container port section below ?

Ports:
— containerPort : <Env Variable >
env :
— name : MyPort
value : “8080”

Md. Raise Azam:
@Tej_Singh_Rana Can you help me with the above ?

Deepak Ladwa:
@Md. Raise Azam I don’t think so, as containerPort field supports only integer value.
image.png

Mohamed Ayman:
Mainly containerPort does not really affect connectivity and only informational for documentation. It is used by developers to understand the port that the container listens to.

Mohamed Ayman:
It can only be referenced from service by the containerPort name.