<p>I am trying to deploy an app to Kubernetes cluster via Helm charts. Every time I try to deploy the app I get </p>

<blockquote>
  <p>"Liveness probe failed: Get <a href="http://172.17.0.7:80/" rel="nofollow noreferrer">http://172.17.0.7:80/</a>: dial tcp
  172.17.0.7:80: connect: connection refused" and "Readiness probe failed: Get <a href="http://172.17.0.7:80/" rel="nofollow noreferrer">http://172.17.0.7:80/</a>: dial tcp 172.17.0.7:80: connect:
  connection refused"</p>
</blockquote>

<p>. </p>

<p>This is my deployment.yaml:</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "mychart.fullname" . }}
  labels:
    {{- include "mychart.labels" . | nindent 4 }}
spec:
  replicas: {{ .Values.replicaCount }}
  selector:
    matchLabels:
      {{- include "mychart.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        {{- include "mychart.selectorLabels" . | nindent 8 }}
    spec:
    {{- with .Values.imagePullSecrets }}
      imagePullSecrets:
        {{- toYaml . | nindent 8 }}
    {{- end }}
      serviceAccountName: {{ include "mychart.serviceAccountName" . }}
      securityContext:
        {{- toYaml .Values.podSecurityContext | nindent 8 }}
      containers:
        - name: {{ .Chart.Name }}
          securityContext:
            {{- toYaml .Values.securityContext | nindent 12 }}
          image: nikovlyubomir/docker-spring-boot:latest
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          ports:
            - name: http
              containerPort: 80
              protocol: TCP
          livenessProbe:
            initialDelaySeconds: 200
            httpGet:
              path: /
              port: 80
          readinessProbe:
            initialDelaySeconds: 200
            httpGet:
              path: /
              port: http
          resources:
            {{- toYaml .Values.resources | nindent 12 }}
      {{- with .Values.nodeSelector }}
      nodeSelector:
        {{- toYaml . | nindent 8 }}
      {{- end }}
    {{- with .Values.affinity }}
      affinity:
        {{- toYaml . | nindent 8 }}
    {{- end }}
    {{- with .Values.tolerations }}
      tolerations:
        {{- toYaml . | nindent 8 }}
    {{- end }}



</code></pre>

<p>I read that possible solution might be adding more initialDelaySecond in both probes, but still this did not resolve my issue.</p>

<p>Any opinion? </p>

<p>Since I can pull the image  I did a try</p>

<pre><code>$ docker run -d nikovlyubomir/docker-spring-boot:latest
9ac42a1228a610ae424217f9a2b93cabfe1d3141fe49e0665cc71cb8b2e3e0fd
</code></pre>

<p>I got logs</p>

<pre><code>$ docker logs 9ac
...
2020-03-08 02:02:30.552  INFO 1 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 1993 (http) with context path ''
</code></pre>

<p>Seems the application starts on port 1993, not 80</p>

<p>then I check the port and connection in container: </p>

<pre><code>$ docker exec -ti 9ac bash
root@9ac42a1228a6:/# curl localhost:1993
{"timestamp":"2020-03-08T02:03:12.104+0000","status":404,"error":"Not Found","message":"No message available","path":"/"}
root@9ac42a1228a6:/# curl localhost:1993/actuator/health
{"timestamp":"2020-03-08T02:04:01.348+0000","status":404,"error":"Not Found","message":"No message available","path":"/actuator/health"}
root@9ac42a1228a6:/# curl localhost:80
curl: (7) Failed to connect to localhost port 80: Connection refused
root@9ac42a1228a6:/# curl localhost:80/actuator/health
curl: (7) Failed to connect to localhost port 80: Connection refused
</code></pre>

<p>So make sure the check path <code>/</code> or other is properly set and the port <code>80</code> or <code>1993</code> is ready.</p>
