I'm on macOS Catalina 10.15.4, and I'm using minikube v1.11.0 and kubernetes v1.18.3, both installed from brew. Minikube is initialized with the docker engine.
The initialization command is set up like so:
containers:
- name: database
image: "mysql:5.6"
imagePullPolicy: IfNotPresent
env:
- name: MYSQL_ROOT_PASSWORD
value: 12345
- name: MYSQL_USER
value: user
- name: MYSQL_PASSWORD
value: password
- name: MYSQL_DATABASE
value: db
I'm trying to get a bash script open for one of my running kubectl containers. From research online, it appears that this should be the command that will open a bash window in my terminal:
minikube kubectl exec -it --namespace=tools test-pod -- bash
However, when I run it, I get the following traceback:
Error: unknown shorthand flag: 'i' in -it See 'minikube kubectl --help' for usage.
It doesn't seem to want me using any arguments in my command. Is there something I'm missing, or am I attempting to use a command that is deprecated?
Note: I am able to run exec
, but not for opening a bash script. For example, I am able to run the following command:
minikube kubectl exec test-pod -- ls /
And it outputs this following:
kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl kubectl exec [POD] -- [COMMAND] instead.
bin
boot
dev
docker-entrypoint-initdb.d
entrypoint.sh
etc
home
lib
lib64
media
mnt
opt
proc
root
run
sbin
srv
sys
tmp
usr
var
Edit: I have attempted the following command:
minikube kubectl exec --stdin --tty --namespace=tools test-pod -- sh
And I got the following traceback:
Error: unknown flag: --stdin
See 'minikube kubectl --help' for usage.
It seems like any flags at all, short or long, are failing, and I cannot figure out why they wouldn't be.
minikube kubectl
needs the --
after the command when you want to use it with arguments:
$ minikube kubectl -- exec --stdin --tty --namespace=tools test-pod -- sh
You can also use plain kubectl
If would just make sure that your ~/.kube/config
is pointing to the right minikube context/cluster. Typically, any minikube command you run from the shell will cause it to change the context to your minikube cluster. i.e minikube ssh
Then just use kubectl
$ kubectl exec --stdin --tty --namespace=tools test-pod -- sh
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With