Eth*_*ill 6 bash docker kubernetes kubectl minikube
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
Run Code Online (Sandbox Code Playgroud)
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
Run Code Online (Sandbox Code Playgroud)
Edit: I have attempted the following command:
minikube kubectl exec --stdin --tty --namespace=tools test-pod -- sh
Run Code Online (Sandbox Code Playgroud)
And I got the following traceback:
Error: unknown flag: --stdin
See 'minikube kubectl --help' for usage.
Run Code Online (Sandbox Code Playgroud)
It seems like any flags at all, short or long, are failing, and I cannot figure out why they wouldn't be.
Ric*_*ico 10
minikube kubectl需要--的命令后,当你想带参数的使用:
$ minikube kubectl -- exec --stdin --tty --namespace=tools test-pod -- sh
Run Code Online (Sandbox Code Playgroud)
您也可以使用普通 kubectl
如果只是确保您~/.kube/config指向正确的 minikube 上下文/集群。通常,您从 shell 运行的任何 minikube 命令都会使其将上下文更改为您的 minikube 集群。IEminikube ssh
然后只需使用 kubectl
$ kubectl exec --stdin --tty --namespace=tools test-pod -- sh
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6249 次 |
| 最近记录: |