在现有 kubernetes pod 中按需创建容器
On-demand creation of a container in an existing kubernetes pod
假设我有一个 pod 处于活动状态并且最初只包含一个活动容器。
此容器是 typescript 中的 nodejs 应用程序,在浏览器中打开时显示用户界面。
这个容器可以在 SAME POD 中创建另一个容器 on-demand/dynamically 吗?
我们怎样才能做到这一点?请指教
此外,重用像 https://www.npmjs.com/package/kubernetes-client 这样的 npm 模块是否有助于在同一 pod 中创建此类容器?
Can this container create another container on-demand/dynamically within the SAME POD ? How can we achieve this?
不,Pod 中的容器是在 PodTemplate
中声明的,需要在创建 Pod 之前预先声明。更具体地说,你有什么用例?你想达到什么目的?
Also, will reusing npm modules like https://www.npmjs.com/package/kubernetes-client help in creating such containers within the same pod?
kubernetes 客户端库可用于与 ApiServer 交互,例如用于部署新应用程序或 Pods。但是 Kubernetes 部署单元 是一个 Pod - 这是您使用的最小单元。要更改 Pod,您需要创建一个新 Pod 并终止前一个 Pod。
假设我有一个 pod 处于活动状态并且最初只包含一个活动容器。 此容器是 typescript 中的 nodejs 应用程序,在浏览器中打开时显示用户界面。
这个容器可以在 SAME POD 中创建另一个容器 on-demand/dynamically 吗? 我们怎样才能做到这一点?请指教
此外,重用像 https://www.npmjs.com/package/kubernetes-client 这样的 npm 模块是否有助于在同一 pod 中创建此类容器?
Can this container create another container on-demand/dynamically within the SAME POD ? How can we achieve this?
不,Pod 中的容器是在 PodTemplate
中声明的,需要在创建 Pod 之前预先声明。更具体地说,你有什么用例?你想达到什么目的?
Also, will reusing npm modules like https://www.npmjs.com/package/kubernetes-client help in creating such containers within the same pod?
kubernetes 客户端库可用于与 ApiServer 交互,例如用于部署新应用程序或 Pods。但是 Kubernetes 部署单元 是一个 Pod - 这是您使用的最小单元。要更改 Pod,您需要创建一个新 Pod 并终止前一个 Pod。