nodeName nodeSelector Taints and Tolerations

raghu:
@KK @Rahul Soni Need your help with this scenario: If I expose a service for a pod on port 5555 and I created it with the command “k expose <podname> --name=<svc-name> --port=5555” But I have not exposed the port 5555 on the container in my pod definition file via (ports: containerPort: 5555 tag)? Will my service be still be considered as good? If yes, then whats the effect of ports NOT exposing on the container?

Rahul Soni:
It will be good until and unless you service is reachable withing cluster or via externally and serves the right pod. If you dont explicitly define the container port, default port of the running app is considered, for example port 80. if you expose 5555 then it should be something like 5555:80

raghu:
Thanks @Rahul Soni for the clarification. It cleared my long pending doubt…

raghu:
@Rahul Soni I have one more query: when I am using the “nodeSelector” tag and provide the label from master node (http://kubernetes.io/hostname=master|kubernetes.io/hostname=master) for my deployment, the pods are in pending state for along time, even after recreating it BUT when I am using the “nodeName: master” tag, the pods are scheduled as soon as i hit enter. Could you please tell, if i can use the “nodeName” tag in exam too?

Rahul Soni:
are you using tolerations by any chance ? i dont think without tolerations you can schedule pods on master(if it has taints)

raghu:
so did the nodeName tag by passes all the taints?

Rahul Soni:
no it cannot.

raghu:
this is regarding the CKAD LL-1 - Q6 where we need to put the pod on master node

raghu:
but as i mentioned, with nodeName tag I am able to place pods on master but with nodeSelector, it was going on in pending state.

raghu:
@Rahul Soni I checked the answer file. there nodeselector is used with the tolerations tag. Now my query is that In Exam, to place the pod on master node, can I do it via nodeName tag? Can i do it with nodeName tag which is far easy & fast to write? (also in the LL question, there is not mentioned anythin t use the tolerations)

Rahul Soni:
you just want to place the pod on master, any method you can use, provided you are able to place the pod on correct node.