serving icon indicating copy to clipboard operation
serving copied to clipboard

nodeSelector: validation failed: must not set the field(s): spec.template.spec.nodeSelector

Open springCozyRock opened this issue 1 year ago • 0 comments

hi, I really need you guys help. I need to use nodeSelector to place my service on specific node following https://knative.dev/docs/serving/configuration/feature-flags/#kubernetes-host-aliases. But it failed with following error messages.

beatles@kmaster:~$ sudo kubectl apply -f helloworld-go.yaml 
[sudo] password for beatles: 
Warning: Kubernetes default value is insecure, Knative may default this to secure in a future release: spec.template.spec.containers[0].securityContext.allowPrivilegeEscalation, spec.template.spec.containers[0].securityContext.capabilities, spec.template.spec.containers[0].securityContext.runAsNonRoot, spec.template.spec.containers[0].securityContext.seccompProfile
Error from server (BadRequest): error when creating "helloworld-go.yaml": admission webhook "validation.webhook.serving.knative.dev" denied the request: validation failed: must not set the field(s): spec.template.spec.nodeSelector
beatles@kmaster:~$ 

My yaml file

apiVersion: serving.knative.dev/v1
kind: Service
metadata:
  name: helloworld-go
  namespace: example
spec:
  template:
    spec:
      nodeSelector:
        kubernetes.io/hostname: kmaster
      containers:
      - image: registry.cn-hangzhou.aliyuncs.com/knative-sample/helloworld-go:160e4dc8
        env:
        - name: TARGET
          value: "Go Sample v1"

springCozyRock avatar May 07 '24 03:05 springCozyRock