Using MicroK8s on MacOS with Multipass (1.5.0+Mac)
**> microk8s kubectl create -f reader-deployment.yaml**
error: the path "reader-deployment.yaml" does not exist
An error occurred when trying to execute 'sudo microk8s.kubectl create -f reader-deployment.yaml' with 'multipass': returned exit code 1.
This error makes sense to me, since microk8s is passing the command to a Multipass VM that obviously doesn’t have access to the file system.
Do any of you all use deployment files in this configuration? How do you get it to work?
Since microk8s seems to have a philosophy of transparency on platforms, should this be considered a bug?
You are right on why the command is failing. The yaml file is not available in the VM. You can transfer the file in the VM with multipass transfer.
I am not sure if this is a bug but it is for sure something we have to improve because it hurts user experience. The challenges here are that the user may have yaml manifests anywhere in the host’s file system so we cannot share a specific directory in the VM, the path to the manifest needs some translation, and the -f command may take a directory as argument.
I got the answer on another forum - I had set up ‘kubectl’ on my Mac as an alias for ‘microk8s kubectl’. This would work great on a linux platform where Kubernetes is not running in a VM, but definitely broke on MacOs.
By getting rid of the alias and using the native kubectl command, everything worked. Kubectl can see the files and will communicate the necessary information to microk8s over the API.
I think it would be helpful to update the documentation, but I think it works quite well!