Q:

How to check logs for deployment?

I am trying to deploy one spring boot application which uses postgres database.
I used this tutorial :
https://github.com/mkjelland/spring-boot-postgres-on-k8s-sample
But when I did this commmand 
 kubectl expose deployment spring-boot-postgres-sample --type=LoadBalancer -- 
  port=8080

So it giving External-IP status as  for around 30 minute
So i patch this by using 
kubectl patch svc <svc-name> -n <namespace> -p '{"spec": {"type": "LoadBalancer", "externalIPs":["172.31.71.218"]}}'

So when I tried to access http://172.31.71.218:8080 which is getting timeout.
I want to check logs what happening behind the scenes.
I also tried using cluster-IP service by using yaml file
    apiVersion: v1
kind: Service
metadata:
  labels:
    app: spring-boot-postgres-sample
  name: spring-boot-postgres-sample
  namespace: default
spec:
  ports:
  - nodePort: 30500
    port: 80
    protocol: TCP
    targetPort: 80
  selector:
    app: spring-boot-postgres-sample
  type: NodePort

Used following commands :-
kubectl create -f service.yaml

Then tried to access 
  http://myhostip:30500/
but still getting timedOut
how do i check it logs
here is output of kubectl describe pod podname
    Name:               spring-boot-postgres-sample-7f7c7479d9-fclwb
Namespace:          default
Priority:           0
PriorityClassName:  <none>
Node:               ip-172-31-11-87/172.31.11.87
Start Time:         Thu, 30 May 2019 11:50:24 +0000
Labels:             app=spring-boot-postgres-sample
                    pod-template-hash=7f7c7479d9
Annotations:        <none>
Status:             Running
IP:                 192.168.1.28
Controlled By:      ReplicaSet/spring-boot-postgres-sample-7f7c7479d9
Containers:
  spring-boot-postgres-sample:
    Container ID:  docker://a1278cc26a66eb3b977cf1946d1490c7c5066e9fe0db8c468fd0e8dc47de5ca2
    Image:         djtijare/a2i-web:v1
    Image ID:      docker-pullable://djtijare/a2i-web@sha256:cbeac029eb3b65760b904e93ced0b417eca349280ba5a809de713d5fbb2d608f
    Port:          <none>
    Host Port:     <none>
    Command:
      /bin/bash
      -ce
      tail -f /dev/null
    State:          Running
      Started:      Thu, 30 May 2019 11:50:46 +0000
    Ready:          True
    Restart Count:  0
    Environment:
      POSTGRES_USER:      <set to the key 'postgres_user' of config map 'postgres-config'>      Optional: false
      POSTGRES_PASSWORD:  <set to the key 'postgres_password' of config map 'postgres-config'>  Optional: false
      POSTGRES_HOST:      <set to the key 'postgres_host' of config map 'hostname-config'>      Optional: false
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-6pksq (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             True
  ContainersReady   True
  PodScheduled      True
Volumes:
  default-token-6pksq:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-6pksq
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:          <none>
aquilak8suser@ip-172-31-6-149:~/a2i-web$ kubectl describe pod spring-boot-postgres-sample-7f7c7479d9-fclwb
Name:               spring-boot-postgres-sample-7f7c7479d9-fclwb
Namespace:          default
Priority:           0
PriorityClassName:  <none>
Node:               ip-172-31-11-87/172.31.11.87
Start Time:         Thu, 30 May 2019 11:50:24 +0000
Labels:             app=spring-boot-postgres-sample
                    pod-template-hash=7f7c7479d9
Annotations:        <none>
Status:             Running
IP:                 192.168.1.28
Controlled By:      ReplicaSet/spring-boot-postgres-sample-7f7c7479d9
Containers:
  spring-boot-postgres-sample:
    Container ID:  docker://a1278cc26a66eb3b977cf1946d1490c7c5066e9fe0db8c468fd0e8dc47de5ca2
    Image:         djtijare/a2i-web:v1
    Image ID:      docker-pullable://djtijare/a2i-web@sha256:cbeac029eb3b65760b904e93ced0b417eca349280ba5a809de713d5fbb2d608f
    Port:          <none>
    Host Port:     <none>
    Command:
      /bin/bash
      -ce
      tail -f /dev/null
    State:          Running
      Started:      Thu, 30 May 2019 11:50:46 +0000
    Ready:          True
    Restart Count:  0
    Environment:
      POSTGRES_USER:      <set to the key 'postgres_user' of config map 'postgres-config'>      Optional: false
      POSTGRES_PASSWORD:  <set to the key 'postgres_password' of config map 'postgres-config'>  Optional: false
      POSTGRES_HOST:      <set to the key 'postgres_host' of config map 'hostname-config'>      Optional: false
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-6pksq (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             True
  ContainersReady   True
  PodScheduled      True
Volumes:
  default-token-6pksq:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-6pksq
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:          <none>

A:

You can get the deployment logs with the following command
kubectl logs -f deployment/spring-boot-postgres-sample

Or if you want the logs for an specific pod
kubectl logs -f spring-boot-postgres-sample-7f7c7479d9-fclwb

