madhuakula / kubernetes-goat

Kubernetes Goat is a "Vulnerable by Design" cluster environment to learn and practice Kubernetes security using an interactive hands-on playground 🚀
https://madhuakula.com/kubernetes-goat
MIT License
4.46k stars 715 forks source link

Please check kubectl set up - short flag deprecated #134

Closed pl4g4 closed 11 months ago

pl4g4 commented 1 year ago

I had some issues when I tried to set this up.

I'm getting the error

~/kubernetes-goat$ bash setup-kubernetes-goat.sh - Error: Could not find kubectl or an other error happened, please check kubectl setup.

It looks like the command in the set up and access script kubectl version --short > /dev/null 2>&1 is always returning the error with kubectl not set up.

I had to comment it out so the script could run.

If I run that command and remove the /dev/null this is what it returns.

kubectl version --short
Flag --short has been deprecated, and will be removed in the future. The --short output will become the default.
Client Version: v1.27.4
Kustomize Version: v5.0.1
Server Version: v1.27.4

This is what I run when I'm installing Kubectl

## Installing kubectl
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
curl -LO "https://dl.k8s.io/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256"
echo "$(cat kubectl.sha256)  kubectl" | sha256sum --check
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl

So short flag would probably need to be removed.

Is anyone else having the same issue?

intrusus-dev commented 1 year ago

I can confirm that this flag is deprecated. Just remove the --short flag and you'll get the same output. If you want to have the client version only, use kubectl version --client.

david-botelho-mariano commented 1 year ago

I fixed it using kubectl 1.23.0:

curl -LO https://dl.k8s.io/release/v1.23.0/bin/linux/amd64/kubectl

sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl

kubectl version --short

pichuang commented 1 year ago

Same issue in here. The --short is deprecated

$ kubectl version
Client Version: v1.28.1
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.27.3

$ kubectl version --short
error: unknown flag: --short
See 'kubectl version --help' for usage.