microk8s: error: error validating "microing.yaml": error validating data: ValidationError(DaemonSet.spec.selector): unknown field "name" in io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector;

Hello Microk8s

I’m trying to expose a custom ssh port that will be used for connecting and cloning the git repo.

Ex: Command that i run:

git clone ssh://aanil@androidhubgit.com:29418/All-Projects

If i create a nodeport and change it to 30000 and then run a clone it works perfectly. However we cannot expose 30000 and it needs to be 29418.

I went through the documentation and found the following link:

https://microk8s.io/docs/addon-ingress

I created a secret with the below yaml file.

apiVersion: v1
kind: ConfigMap
metadata:
  name: nginx-ingress-tcp-microk8s-conf
  namespace: ingress
data:
  29418: "default/gerrit-service:29418"

******************* This works without any errors and i can see the config maps*********************** My deployment yaml file


apiVersion: apps/v1
kind: Deployment
metadata:
  name: gerrit-deployment
  labels:
    app: gerrit-meta
spec:
  replicas: 1
  selector:
    matchLabels:
      app: gerrit
      type: frontend
  template:
    metadata:
      labels:
        app: gerrit
        type: frontend
    spec:
      containers:
      - name: gerrit
        image: gerritcodereview/gerrit
        env:
          - name: CANONICAL_WEB_URL
            value: https://ec2-18-219-145-189.us-east-2.compute.amazonaws.com
        ports:
         - containerPort: 8080
         - containerPort: 29418

******************This also goes through as expected My Service file

apiVersion: v1
kind: Service
metadata:
  name: gerrit-service
  labels:
      app: gerrit
      type: frontend
spec:
  ports:
  - name: 1http
    port: 8080
    protocol: TCP
  - name: sshcon
    port: 29418
    protocol: TCP
  selector:
      app: gerrit
      type: frontend

***************************This also works as expected and creates the service

Now i want to expose the tcp/udp port for 29418 so as per the document i created a new ingress file


---
apiVersion: apps/v1
kind: DaemonSet
metadata:
  labels:
    microk8s: gerritingress
  name: nginx-ingress-microk8s-controller
  namespace: ingress
spec:
  selector:
    name: gerrit
  template:
    metadata:
      labels:
        name: nginx
    spec:
      containers:
        -
          image: "quay.io/kubernetes-ingress-controller/nginx-ingress-controller-amd64:0.25.1"
          name: nginx-ingress-microk8s
          ports:
            -
              containerPort: 80
            -
              containerPort: 443
            -
              containerPort: 29418
              hostPort: 29418
              name: tcp-29418
              protocol: TCP

The instance I apply this file it errors out with

kubectl apply -f microing.yaml error: error validating “microing.yaml”: error validating data: ValidationError(DaemonSet.spec.selector): unknown field “name” in io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector; if you choose to ignore these errors, turn validation off with --validate=false

I tried different approach and all of them fails with similar errors.

Why am i getting this error. Is this the correct approach to expose port 29418 Is there something wrong with the documentation as it fails and i somehow feel this is a defect or less tested.

Kindly guide on how to fix this issue. This is almost like a deal breaker for our setup and i would like to get this fixed or understand the right approch

Thank you, Anish

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 30 (1 by maintainers)

Most upvoted comments

I think the existing manifest provided in the docs are not meant to be used with kubectl apply instead a kubectl patch. You need to edit the current running ingress daemonset. Thats about it.

@ktsakalozos i think we should also update our docs to reflect the valid yaml.