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

5/18/2021

I am facing a similar issue. The "Deployment.yml" is applied successfully but "Services.yml" gives me

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"}

When deployed through the kubectl console, the "Services.yml" is applied successfully. Any help is appreciated?

-- Parth
azure-aks
azure-devops
kubernetes

1 Answer

5/19/2021

In response to my support ticket, MSFT provided this article where simply ticking the 'Check for latest version' in Advanced Section of kubectl task resolves the issue.

Hope this help others :)

-- Parth
Source: StackOverflow