AZ CLI/kubectl apply error - - the path does not exist

7/23/2018

I'm working through a tutorial on Kubernetes on Azure tutorial (here) and everything has worked perfectly until I run the kubectl apply to configure the cluster:

bash-4.4# kubectl apply -f azure-vote-all-in-one-redis.yaml

error: the path "azure-vote-all-in-one-redis.yaml" does not exist

I found this question which is right on point if I were trying to use a URL for the file.

I've tried:

kubectl apply -f azure-vote-all-in-one-redis.yaml

and

kubectl apply -f /Users/bill/Documents/GitHub/azure-voting-app-redis/azure-vote-all-in-one-redis.yaml

The kubectl command is run from the AZ CLI (I'm using VSCode - with everything configured for Azure and Docker - no problems seeing anything).

if I ls from the AZ CLI I get:

bash-4.4# ls
azure-cli  dev        home       media      proc       run        srv        tmp        var
bin        etc        lib        mnt        root       sbin       sys        usr
bash-4.4#

I've also looked through the docs for AZ CLI and kubectl and every indication is that it should simply work. I also tried kubectl from the console which obviously didn't work...

-- Bill Armstrong
azure
kubernetes
visual-studio-code

1 Answer

7/23/2018

As I know, most command like this, when you execute the command with an argument file, you should in the same directory which the file in or with an absolute path of the file.

So you can use two ways to execute the command:

First, you can go into the directory which the file azure-vote-all-in-one-redis.yaml in and then execute the command kubectl apply -f azure-vote-all-in-one-redis.yaml.

Second, you can use an absolute path. How to get the path? You can go into the directory and execute the command pwd. Or you can use the command whereis azure-vote-all-in-one-redis.yaml to get the path.

Update

Here is my test screenshot: enter image description here

Hope it will help you!

-- Charles Xu
Source: StackOverflow