Kubernetes apply command produces 'wrong encoding error'

8/9/2021

I'm trying to execute:

microk8s kubectl apply -f  deployment.yaml 

and I am always getting:

error: string field contains invalid UTF-8

No matter which file and string as a file path parameter I'm trying to use. Even if I execute:

microk8s kubectl apply -f  blablabla

Result is the same.


UPD: I resolved the problem by restarting microk8s service. After restart everything is fine, but I still have no idea what it was.

-- Сергей Коновалов
kubectl
kubernetes
microk8s

1 Answer

8/11/2021

I have posted Community Wiki answer for better visibility.

As OP has mentioned in the question, he resolved the problem by restarting microk8s service:

I resolved the problem by restarting microk8s service. After restart everything is fine.

-- Mikołaj Głodziak
Source: StackOverflow