Unable to form K8S API_PATH URL based on apiVersion for YAML content [VMware Code Stream]

Recently while working in VMware Code Stream to create a Kubernetes pipeline I ran into an error attempting to create an Ingress resource. The error, as stated in the horrible title of this post, was ‘Unable to form K8S API_PATH URL based on apiVersion for YAML content‘. I was running vRealize Automation 8.2 on-prem with an endpoint to a Kubernetes 1.20 cluster.

I knew the YAML definition I was using was good. I had used kubectl from the CLI to deploy an ingress resource successfully with this code.

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: nginx-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
  - host: nginx.ukoticland.local   
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: nginx-lb
            port:
              number: 80

The error seemed to indicate an issue with the API / apiVersion. I knew that the ingress API had gone through a number of different versions of recent. So I changed the apiVersion from networking.k8s.io/v1 to networking.k8s.io/v1beta1. Unfortunately no luck, same error.

A bit of digging around and I next tried the much older apiVersion extensions/v1beta1. This apiVersion required a slight change to the YAML code to process correctly. But once modified for this older apiVersion it actually worked!

My understanding of what Code Stream is doing here is that it needs to take the Kubernetes YAML definition supplied and create a request path based on a vRA supported K8s resource. As you might imagine, all the main K8s api resources are supported by vRA, such as Deployment, Service, Namespace, etc. But if you attempt to use a custom api resource, or changes are made to existing K8s resources from future Kubernetes releases, you may run into issues attempting to execute the action in the Code Stream pipeline as I have.

Hopefully future releases of vRealize Automation and VMware Code Stream do a better job of handling custom api resources and changes to existing resources. In the mean time it’s worth keeping this in mind when creating Kubernetes tasks in Code Stream.

Leave a Reply

Your email address will not be published. Required fields are marked *