How to use the kubectl apply -f filename command in windows minikube

106 Views Asked by At

I'm new to Kubernetes and have installed minikube in my Windows 11 machine. I want to create a kubernetes configuration file say nginx-deployment.yaml and create my deployment using that configuration file.

In Mac OS, the nginx-deployment.yaml file is created using the touch nginx-deployment.yaml command. How to do the same from Windows cmd prompt as touch command won't work?

Also, is it possible to create the nginx-deployment.yaml file in any directory in Windows and specify the path to that directory in the kubectl apply -f path-to-the-configuration-file\filename.yaml command?

the thing I want to replicate in windows minikube

1

There are 1 best solutions below

0
Kranthiveer Dontineni On

There are multiple ways for creating a file using CMD in windows, while using echo is one way(as mentioned by Eran), there are multiple ways to create a file in windows as mentioned here.

Once you have created your file you can pass the path to your kubectl command, similar to linux. However, the path syntax will vary here for example

kubectl apply -f C:\Users\yourUsername\path\to\file.yaml