Fisal Assubaieye
Fisal Assubaieye

Reputation: 346

The request is invalid: patch: Invalid value:... cannot convert int64 to string and Error from server (BadRequest): json: cannot unmarshal string

I'm sure regarding YAML format and kubernetes (AWS EKS) as per validations of Kubeval & Yamllint.

The following is a aws-auth-patch.yml file.

enter image description here

However... When I executed in CMD kubectl patch configmap/aws-auth -n kube-system --patch "$(cat aws-auth-patch.yml)"

error: Error from server (BadRequest): json: cannot unmarshal string into Go value of type map[string]interface {}

Also in Windows PowerShell kubectl patch configmap/aws-auth -n kube-system --patch $(Get-Content aws-auth-patch.yml -Raw)

error: The request is invalid: patch: Invalid value: "map[apiVersion:v1 data:map[....etc...": cannot convert int64 to string

I think that YAML file format is normal.

What is causing this error?

Upvotes: 1

Views: 6378

Answers (1)

Fisal Assubaieye
Fisal Assubaieye

Reputation: 346

I've solved it by change my OS from Windows 10 to WSL (Windows Sub-system for Linux ) (ubuntu 20.04 LTS) and now the below command executed successfully.

kubectl patch configmap/aws-auth -n kube-system --patch "$(cat aws-auth-patch.yml)"

and result is:

configmap/aws-auth patched

Upvotes: 1

Related Questions