<p>I am trying to deploy one spring boot application which uses postgres database.</p>

<p>I used this tutorial :
<a href="https://github.com/mkjelland/spring-boot-postgres-on-k8s-sample" rel="nofollow noreferrer">https://github.com/mkjelland/spring-boot-postgres-on-k8s-sample</a></p>

<p>But when I did this commmand </p>

<pre><code> kubectl expose deployment spring-boot-postgres-sample --type=LoadBalancer -- 
  port=8080
</code></pre>

<p>So it giving External-IP status as  for around 30 minute</p>

<p>So i patch this by using </p>

<pre><code>kubectl patch svc &lt;svc-name&gt; -n &lt;namespace&gt; -p '{"spec": {"type": "LoadBalancer", "externalIPs":["172.31.71.218"]}}'
</code></pre>

<p>So when I tried to access <a href="http://172.31.71.218:8080" rel="nofollow noreferrer">http://172.31.71.218:8080</a> which is getting timeout.</p>

<p>I want to check logs what happening behind the scenes.</p>

<p>I also tried using cluster-IP service by using yaml file</p>

<pre><code>    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
</code></pre>

<p>Used following commands :-</p>

<pre><code>kubectl create -f service.yaml
</code></pre>

<p>Then tried to access 
  <a href="http://myhostip:30500/" rel="nofollow noreferrer">http://myhostip:30500/</a></p>

<p>but still getting timedOut
how do i check it logs</p>

<p>here is output of <strong>kubectl describe pod podname</strong></p>

<pre><code>    Name:               spring-boot-postgres-sample-7f7c7479d9-fclwb
Namespace:          default
Priority:           0
PriorityClassName:  &lt;none&gt;
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:        &lt;none&gt;
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:          &lt;none&gt;
    Host Port:     &lt;none&gt;
    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:      &lt;set to the key 'postgres_user' of config map 'postgres-config'&gt;      Optional: false
      POSTGRES_PASSWORD:  &lt;set to the key 'postgres_password' of config map 'postgres-config'&gt;  Optional: false
      POSTGRES_HOST:      &lt;set to the key 'postgres_host' of config map 'hostname-config'&gt;      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:  &lt;none&gt;
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:          &lt;none&gt;
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:  &lt;none&gt;
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:        &lt;none&gt;
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:          &lt;none&gt;
    Host Port:     &lt;none&gt;
    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:      &lt;set to the key 'postgres_user' of config map 'postgres-config'&gt;      Optional: false
      POSTGRES_PASSWORD:  &lt;set to the key 'postgres_password' of config map 'postgres-config'&gt;  Optional: false
      POSTGRES_HOST:      &lt;set to the key 'postgres_host' of config map 'hostname-config'&gt;      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:  &lt;none&gt;
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:          &lt;none&gt;
</code></pre>

Dhanraj
<p>You can get the deployment logs with the following command</p>

<pre><code>kubectl logs -f deployment/spring-boot-postgres-sample
</code></pre>

<p>Or if you want the logs for an specific pod</p>

<pre><code>kubectl logs -f spring-boot-postgres-sample-7f7c7479d9-fclwb
</code></pre>
