Hi All, So I was going through the K8s liveness probe documentation and saw the . . .

pikachunetes:
Hi All,
So I was going through the K8s liveness probe documentation and saw the below yaml:
apiVersion: v1
kind: Pod
metadata:
labels:
test: liveness
name: liveness-http
spec:
containers:
- name: liveness
image: <http://k8s.gcr.io/liveness|k8s.gcr.io/liveness>
args:
- /server
livenessProbe:
httpGet:
path: /healthz
port: 8080
httpHeaders:
- name: Custom-Header
value: Awesome
initialDelaySeconds: 3
periodSeconds: 3

Can some pls explain how are we able to perform a get request without exposing 8080 container port in the pod spec
and what is the significance of the args: /server, is that also playing a role over here
Thankyou

Sangeetha Radhakrishnan:
The /server argument is nothing to do with respect to liveness. Deploying this pod yaml will help you to understand more about how it works.
As per the liveness docker image the /healthy api is up only during initial 10 seconds. After deploying this pod
Use kubectl describe pod command to know which IP the pod is running. Using curl command hit this api(curl http://<pod IP address>:8080/healthz. For initial 10 seconds it will return ok. After that you will see error response. You need to expose the pod only if you need to access it via nodeport or load balancer. In this it is internal call without exposing the pod it would work.

pikachunetes:
@Sangeetha Radhakrishnan Thanks for the answer.
If we follow the same approach for the below liveness probe using a tcp socket
apiVersion: v1
kind: Pod
metadata:
name: goproxy
labels:
app: goproxy
spec:
containers:
- name: goproxy
image: <http://k8s.gcr.io/goproxy:0.1|k8s.gcr.io/goproxy:0.1>
ports:
- containerPort: 8080
readinessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 5
periodSeconds: 10
livenessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 15
periodSeconds: 20
if we remove the containerPort: 8080 line, the probe should still work right as this is also an internal request.