question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:30 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
balchuacommented, Aug 20, 2020

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.

1reaction
balchuacommented, Aug 20, 2020

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

error validating data: ValidationError(DaemonSet.spec ...
yaml ": error validating data: ValidationError(DaemonSet.spec.selector): unknown field "name" in io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector; #1500.
Read more >
error validating data: ValidationError(Deployment.spec ...
NodeSelector is not a field of the "metadata" section of your pod template. it needs to be under "spec.template.spec". see this example:
Read more >
error validating data: ValidationError(Deployment): unknown ...
yml file that makes Kubernetes want to issue the above error? apiVersion: apps/v1 kind: Deployment metadata: name: client-deployment spec: ...
Read more >
Getting indentation error - Discuss Kubernetes
error : error validating "test.yaml": error validating data: ValidationError(Deployment.spec.selector): unknown field "matchlabels" in ...
Read more >
error validating "fin12.yaml": error validating data ... - KodeKloud
Container, ValidationError(Pod.spec.containers[0]): unknown field “periodSeconds” in io.k8s.api.core.v1.Container]; if you choose to ignore ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found