Problem creating VPA resource to monitor PXC cluster

I’m trying to test VPA autoscaler with PXC cluster by following the instruction given in the blog “Kubernetes Scaling Capabilities with Percona XtraDB Cluster”.

The test cluster is running on minikube. PXC created successfully , metrics server and and VPA also deployed without issue.

But a problem happened when I tried to create VPA resource to monitor the cluster.

~% kubectl apply -f vpa.yaml

error: error validating "vpa.yaml": error validating data: [ValidationError(VerticalPodAutoscaler): unknown field "\u00a0\u00a0name" in io.k8s.autoscaling.v1.VerticalPodAutoscaler, ValidationError(VerticalPodAutoscaler): unknown field "\u00a0\u00a0\u00a0\u00a0apiVersion" in io.k8s.autoscaling.v1.VerticalPodAutoscaler, ValidationError(VerticalPodAutoscaler): unknown field "\u00a0\u00a0\u00a0\u00a0kind" in io.k8s.autoscaling.v1.VerticalPodAutoscaler, ValidationError(VerticalPodAutoscaler): unknown field "\u00a0\u00a0\u00a0\u00a0name" in io.k8s.autoscaling.v1.VerticalPodAutoscaler, ValidationError(VerticalPodAutoscaler): unknown field "\u00a0\u00a0\u00a0\u00a0updateMode" in io.k8s.autoscaling.v1.VerticalPodAutoscaler, ValidationError(VerticalPodAutoscaler): missing required field "spec" in io.k8s.autoscaling.v1.VerticalPodAutoscaler]; if you choose to ignore these errors, turn validation off with --validate=false

I use vpa.yaml file posted in the blog, only removed the key “namespace” since the cluster is deployed in the default namespace. Below is the content of vpa.yaml

apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
metadata:
name: pxc-vpa
spec:
targetRef:
apiVersion: “apps/v1”
kind: StatefulSet
name: cluster1-pxc
updatePolicy:
updateMode: “Off”

What did I miss? Any suggestion to fix the problem?

1 Like

Hello @pqs0103 ,

seems you have some formatting issues in the yaml itself.
Which editor are you using? Can you open it in vim and see if there are any tabs or special chars?

1 Like

I used VIM for editing. It’s indented properly, not sure why it’s displayed without indentation here. Below is a VIM screen shot with special characters displayed
Screen Shot 2021-04-23 at 9.37.11 AM

1 Like

I tried your VPA config and it works for me.
What are these “$” signs?

1 Like