Home > Software engineering >  Kubernetes ingress nginx "not found" (les jackson tutorial)
Kubernetes ingress nginx "not found" (les jackson tutorial)

Time:07-17

I'm following the kubectl get ingress

kubectl describe ing ingress-srv
kubectl describe ing ingress-srv

Dockerfile CommandService

FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build-env
WORKDIR /app

COPY *.csproj ./
RUN dotnet restore

COPY . ./
RUN dotnet publish -c Release -o out

FROM mcr.microsoft.com/dotnet/aspnet:5.0
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT [ "dotnet", "PlatformService.dll" ]

kubectl logs ingress-nginx-controller-6bf7bc7f94-v2jnp -n ingress-nginx LOGS INGRESS POD

Am I missing something?

CodePudding user response:

So this can occur from several reasons:

  1. Pods or containers are not working - try using kubectl get pods -n <your namespace> to see if any are not in 'running' status.
  2. Assuming they are running, try kubectl describe pod <pod name> -n <your namespace> to see the events on your pod just to make sure its running properly.
  3. I have noticed you are not exposing ports in your deployment. please update your deployments like so:
    apiVersion: apps/v1
    kind: Deployment
    metadata:
     name: platforms-depl
    spec:
     replicas: 1
     selector:
      matchLabels:
       app: platformservice
     template:
      metadata:
       labels:
        app: platformservice
      spec:
       containers:
        - name: platformservice
          image: maartenvissershub/platformservice:latest
          ports:
            - name: http
              containerPort: 80
              protocol: TCP
    ---
    apiVersion: v1
    kind: Service
    metadata:
     name: platforms-clusterip-srv
    spec:
     type: ClusterIP
     selector:
      app: platformservice
     ports:
      - name: platformservice
        protocol: TCP
        port: 80
        targetPort: 80
    
    apiVersion: apps/v1
    kind: Deployment
    metadata:
     name: commands-depl
    spec:
     replicas: 1
     selector:
      matchLabels:
       app: commandservice
     template:
      metadata:
       labels:
        app: commandservice
      spec:
       containers:
        - name: commandservice
          image: maartenvissershub/commandservice:latest
          ports:
            - name: http
              containerPort: 80
              protocol: TCP
    ---
    apiVersion: v1
    kind: Service
    metadata:
     name: commands-clusterip-srv
    spec:
     type: ClusterIP
     selector:
      app: commandservice
     ports:
      - name: commandservice
        protocol: TCP
        port: 80
        targetPort: 80

Hope this helps!

CodePudding user response:

I found my solution. There was a process running on port 80 with pid 4: 0.0.0.0:80. I could stop it using NET stop HTTP in an admin cmd.

I noticed that running kubectl get services -n=ingress-nginx resulted a ingress-nginx-controll, which is fine, but with an external-ip . Running kubectl get ingress also didn't show an ADDRESS. Now they both show "localhost" as value for external-ip and ADDRESS.

Reference: Port 80 is being used by SYSTEM (PID 4), what is that?

  • Related