K8S使用问题汇总

1,报错如下

Warning: kubectl apply should be used on resource created by either kubectl create --save-config or kubectl apply
deployment "nginx-deployment" configured

 是个警告,可以忽略,参考:https://my.oschina.net/u/2306127/blog/1647246  

2.如何使用Kubernetes在一个yaml文件中设置多个命令?

command: ["/bin/sh","-c"] 
args: ["command one; command two && command three"]

说明:的command ["/bin/sh", "-c"]说: “运行shell,并执行下列指令”。这些参数然后作为命令传递给shell。在shell脚本中,分号分隔命令,如果第一个成功,则有条件地运行以下命令。在上面的示例中,它总是运行command one,然后是command two,如果command two成功,则只运行command three

替代方案:在很多情况下,您想要运行的某些命令可能会设置最终的命令来运行。在这种情况下,建立你自己的Dockerfile是要走的路。尤其要看RUN指令。

原文地址:https://www.cnblogs.com/robinunix/p/11159810.html