Helm: How to access an MVC Core WebAPI Endpoint?

2/22/2018

First off, I am brand new to Helm. I am trying to deploy an .Net Core WebApi from Docker Hub called mooo999/webapi. I tested this locally, and it works fine. I have been fiddling with this for days and cannot get the simplest Chart to run. Deployment.yaml is:

    apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: {{ template "foochart.fullname" . }}
  labels:
    app: {{ template "foochart.name" . }}
    chart: {{ template "foochart.chart" . }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
spec:
  replicas: {{ .Values.replicaCount }}
  selector:
    matchLabels:
      app: {{ template "foochart.name" . }}
      release: {{ .Release.Name }}
  template:
    metadata:
      labels:
        app: {{ template "foochart.name" . }}
        release: {{ .Release.Name }}
    spec:
      containers:
        - name: {{ .Chart.Name }}
          image: mooo999/webapi
          imagePullPolicy: IfNotPresent
          ports:
            - name: http
              containerPort: 80
              protocol: TCP
          livenessProbe:
            httpGet:
              path: /api/values
              port: http
          readinessProbe:
            httpGet:
              path: /api/values
              port: http
          resources:
{{ toYaml .Values.resources | indent 12 }}
    {{- with .Values.nodeSelector }}
      nodeSelector:
{{ toYaml . | indent 8 }}
    {{- end }}
    {{- with .Values.affinity }}
      affinity:
{{ toYaml . | indent 8 }}
    {{- end }}
    {{- with .Values.tolerations }}
      tolerations:
{{ toYaml . | indent 8 }}
    {{- end }}

service.yaml is:

apiVersion: v1
kind: Service
metadata:
  name: {{ template "foochart.fullname" . }}
  labels:
    app: {{ template "foochart.name" . }}
    chart: {{ template "foochart.chart" . }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
spec:
  type: NodePort
  ports:
    - port: 80
      targetPort: http
      protocol: TCP
      name: http
  selector:
    app: {{ template "foochart.name" . }}
    release: {{ .Release.Name }}

Not sure it gets much simpler than this. I am deplying to Azure AKS and it deploys fine with no errors. I can get the endpoint:port using:

kubectl get --namespace default -o jsonpath="{.spec.ports[0].nodePort}" services callous-guppy kubectl get nodes --namespace default -o jsonpath="{.items[0].status.addresses[0].address}" but using this info in a browser errors with [Fiddler] The connection to '10.240.0.4' failed. Error: TimedOut (0x274c).

System.Net.Sockets.SocketException A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 10.240.0.4:32678

Do I need an Ingress Service? Does anyone have a simple Chart that actually exposes a public endpoint somehow? I have gone thru countless examples and have been successful with none of them.

-- Mike W
kubernetes-helm

1 Answer

3/9/2018

The default ingress.yaml when you create a chart should be enough, just add the service name to the backend service and set ingress to enabled.

Also you could try use loadbalancer as the service type to test endpoint

-- doe1331
Source: StackOverflow