sh Kubernetes:运行测试容器

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh Kubernetes:运行测试容器相关的知识,希望对你有一定的参考价值。

First lets undertand how the command is constructed

```
$ kubectl run -it --rm --restart=Never --image=mysql:5.6 mysql-client — \
  mysql -h mwmobile.db.main.staging.mobile.meltwater.io -P 3306 -u root -p$PASSWORD
$ kubectl run -it --rm --restart=Never --image=meltwaterfoundation/drone-git bash — \
  bash
#    ^     ^   ^^   ^           ^             ^                               ^
#    |     |   ||   |           |             |                            Pod Name
#    |     |   ||   |           |             +--------------------------- Image
#    |     |   ||   |           +----------------------------------------- No Deployment
#    |     |   ||   +----------------------------------------------------- Remove Image
#    |     |   |+--------------------------------------------------------- TTY Session
#    |     |   +---------------------------------------------------------- Interactive
#    |     +-------------------------------------------------------------- EG: docker run
#    +-------------------------------------------------------------------- v1.10.12+
```

Now that you know how it is constructed, congratulations, because you can do the same thing with virtually any docker container that is available on dockerhub, quay, private rpeos, etc.  Enjoy!
kubectl run -it --rm --restart=Never --image=mysql:5.6 mysql-client — \
  mysql -h $DB_HOST -P 3306 -u $DB_USER -p$DB_PASSWORD
kubectl run -it --rm --restart=Never --image=meltwaterfoundation/drone-git bash — \
  bash

以上是关于sh Kubernetes:运行测试容器的主要内容,如果未能解决你的问题,请参考以下文章

原生Kubernetes容器云平台基本测试使用

Kubernetes:如何从 Docker 容器 A 在 Docker 容器 B 上运行 Bash 命令

3.Kubernetes权威指南 --- 深入掌握Pod

3.Kubernetes权威指南 --- 深入掌握Pod

构建和管理容器的10个技巧

为什么是容器,Docker和Kubernetes?