Gaurav Garg:
Hi all , anyone can suggest in the below question statement do we need to expose the service as well or just expose the container port is enough ?
create pod in the somenamespace , the name of the pod should be some-app , use the redis image with the 4.0-alpine tag , expose port 6379 @Tej_Singh_Rana
Tej_Singh_Rana:
Hello, @Gaurav Garg
Yeah, there is a command. AFAIK
kubectl run xyz --image=redis:4.0-alpine --port=6379 --expose
Gaurav Garg:
Thanks for the reply , my question is that do we need to expose the pod as service as well ?
Gaurav Garg:
because question statemnt is little bit confusing its saying to expose port 6379 , in that question nowhere is mentioned to create/expose service as well @Tej_Singh_Rana
Tej_Singh_Rana:
Okay then adding ports in definition file is fine.
Gaurav Garg:
if we create service due to confusion of question , will it be any problem in exam ?
Gaurav Garg:
i mean still our answer will be right so we will get marks for that ?
Basavraj Nilkanthe:
@Gaurav Garg when it mention expose to port means you just need to expose container to specific port… you dont need to create service…
Gaurav Garg:
Thanks @Basavraj Nilkanthe
Basavraj Nilkanthe:
you can do that using below :
kubectl run xyz --image=redis:4.0-alpine --port=6379
Basavraj Nilkanthe:
you dont need to mention --expose here
Gaurav Garg:
Sure , thanks @Basavraj Nilkanthe
Basavraj Nilkanthe:
@Gaurav Garg this is bit confusing questions, I came to know while practicing github questions…
Tejas is right here and sometime when they mention expose it to containerPort probably you can refer my advise and when it simply say expose it on port :80 then you have to use below and same suggested by Tejas
Gaurav Garg:
yah this is the confusion even i was also confused so that only i post here , but i think untill its not specified in question statement we should not used exposed