ADO:验证数据时出错:服务器找不到请求的

ADO: error validating data: the server could not find the requested

我正面临 similar issue。 “Deployment.yml”已成功应用,但“Services.yml”给我

error validating data: the server could not find the requested resource

Deployment.yml

--- 
apiVersion: apps/v1
kind: Deployment
metadata: 
  name: #{component}#
spec: 
  replicas: #{replica}#
  selector: 
    matchLabels: 
      app: #{component}#
  template: 
    metadata: 
      labels: 
        app: #{component}#
    spec: 
      containers: 
        - 
          env: 
            - 
              name: AUTHOR
              value: #{author}#
          image: #{acr}#/#{component}#:#{stage}#-#{Build.BuildId}#
          imagePullPolicy: Always
          name: #{component}#
          ports: 
            - 
              containerPort: 8000
          resources: 
            limits: 
              cpu: "1"
              memory: 512Mi
            requests: 
              cpu: "0.25"
              memory: 256Mi
      imagePullSecrets: 
        - 
          name: "acrakssecret"

Services.yml

--- 
apiVersion: v1
kind: Service
metadata: 
  name: #{component}#
spec: 
  ports: 
    - 
      name: #{component}#
      port: 443
      protocol: TCP
      targetPort: 8000
  selector: 
      app: #{component}#
  type: LoadBalancer

Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.0", GitCommit:"cb303e613a121a29364f75cc67d3d580833a7479", GitTreeState:"clean", BuildDate:"2021-04-08T16:31:21Z", GoVersion:"go1.16.1", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.5", GitCommit:"54684493f8139456e5d2f963b23cb5003c4d8055", GitTreeState:"clean", BuildDate:"2021-03-22T23:02:59Z", GoVersion:"go1.15.8", Compiler:"gc", Platform:"linux/amd64"}

通过 kubectl 控制台部署时,“Services.yml”应用成功。感谢任何帮助?

作为对我的支持请求的回应,MSFT 提供了 this article,只需勾选 kubectl 任务的高级部分中的 'Check for latest version' 即可解决问题。

希望这对其他人有帮助:)