Question

How to setup a .netcore application with Kubernetes

I have the following deployment configuration file for a .NET core 5.0 web api which I am trying to deploy on my DigitalOcean Kubernetes Cluster

apiVersion: apps/v1
kind: Deployment
metadata:
  name: test-email
  labels:
    app: test-email
spec:
  replicas: 1
  selector:
    matchLabels:
      app: test-email-deployment
  template:
    metadata:
      labels:
        app: test-email-deployment
    spec:
      containers:
      - name: test-email-deployment
        image: booij/email.service
        ports:
        - containerPort: 2000
        resources:
          requests:
            memory: 50Mi
            cpu: 50m
          limits:
            memory: 100Mi
            cpu: 1000m
        env:
        - name: ASPNETCORE_ENVIRONMENT
          value: Staging
---
apiVersion: v1
kind: Service
metadata:
  name: test-email-service
  annotations:
    service.beta.kubernetes.io/do-loadbalancer-name: "test-email-loadbalancer"
    service.beta.kubernetes.io/do-loadbalancer-protocol: "http"
    service.beta.kubernetes.io/do-loadbalancer-healthcheck-path: "/index.html"
spec:
  selector:
    app: test-email-deployment
  type: LoadBalancer
  externalTrafficPolicy: Local
  ports:
    - protocol: TCP
      port: 80
      targetPort: 2000




When I check the container logs everything seems to work, but the DigitalOcean loadbalancer says it is unhealthy, so the status of the loadbalancer is down. I have configured the loadbalancer to use “/index.html” which is the landing page of my api and provides a 200 OK status or is something else required? What am I missing or doing wrong?


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer