Hello Team ,
I have specific question as to how we can connect to container/pod and look at the logs from the container .
Question
1)I have created a deployment with 3 replicas .
Now when i say kubectl logs -f nginx-bf5d5cf98-qhbk5
I am looking at the logs from the container or the application running within the container ? The application that is running within the pod is nginx.
PS C:\Users\kkaushal> kubectl get pods
NAME READY STATUS RESTARTS AGE
event-simulator 2/2 Running 0 6m43s
nginx-bf5d5cf98-6zp64 1/1 Running 0 4h57m
nginx-bf5d5cf98-bfqgf 1/1 Running 0 4h57m
nginx-bf5d5cf98-qhbk5 1/1 Running 0 4h57m
nginx-cas-68f7fcd8b7-hxwjh 0/1 Pending 0 3h30m
php-apache-678865dd57-4fp9j 1/1 Running 0 4h57m
PS C:\Users\kkaushal> kubectl logs -f nginx-bf5d5cf98-qhbk5
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
/docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
2025/01/19 05:58:33 [notice] 1#1: using the “epoll” event method
2025/01/19 05:58:33 [notice] 1#1: nginx/1.27.3
2025/01/19 05:58:33 [notice] 1#1: built by gcc 12.2.0 (Debian 12.2.0-14)
2025/01/19 05:58:33 [notice] 1#1: OS: Linux 5.15.0-1075-azure
2025/01/19 05:58:33 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2025/01/19 05:58:33 [notice] 1#1: start worker processes
2025/01/19 05:58:33 [notice] 1#1: start worker process 30
2025/01/19 05:58:33 [notice] 1#1: start worker process 31
2025/01/19 05:58:33 [notice] 1#1: start worker process 32
2025/01/19 05:58:33 [notice] 1#1: start worker process 33
2)How can we connect to the container within the POD ?