Skip to content

NodePort not accessible after kubernetes reset #6178

@xXblack-lionXx

Description

@xXblack-lionXx

DISCLAIMER: I am very new to kubernetes!

I am currently witnessing weird behaviour on a single node local kubernetes cluster from docker desktop and I am wondering wether it is actually a bug or just a very annoying (at least to me) feature.
I got a very basic server running in a deployment and a service. I configure the service with nodePort and set a port address, lets say 30100. So far this works fine I can access my server and under the port 30100. That is until I reset the kubernetes cluster in docker desktop. When i now apply my previous configuration my server boots up fine and all BUT I cant access it from the outside. When I change the preconfigured NodePort to lets say 30101 and reset kubernetes in docker desktop it works again. Oh and after restarting my computer it works again as well. By the way I had this issue on both my mac and windows PC.

Is there a feature I am missing or is this a weird bug that was worth reporting?

If this is in fact unexpected behaviour I can provide a simple bug recreation. Should take me 5 minutes.

Here my yaml configuration:

kind: Service
metadata:
  name: bug-service
spec:
  selector:
    app: bugapi
  ports:
    - protocol: "TCP"
      port: 8080
      nodePort: 30100 # dont let kubernetes assign a port itself
  type: NodePort
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: bugapi
spec:
  selector:
    matchLabels:
      app: bugapi
  replicas: 1
  template:
    metadata:
      labels:
        app: bugapi
    spec:
      containers:
        - name: bugapi
          image: bugapi
          imagePullPolicy: IfNotPresent
          ports:
            - containerPort: 30100
              name: bugapi-0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions