[英]Create a deployment from a pod in kubernetes
For a use case I need to create deployments from a pod when a script is being executed from inside the pod. 对于一个用例,当从Pod内部执行脚本时,我需要从Pod创建部署。
I am using google container engine for my cluster. 我正在为集群使用Google容器引擎。
How to configure the container inside the pod to be able to run commands like kubectl create deployment.yaml? 如何配置Pod内的容器以运行kubectl create deployment.yaml之类的命令?
PS A bit clueless about it at the moment. PS目前对此一无所知。
Your container is going to need to have kubectl
available. 您的容器将需要有
kubectl
可用。 There are some container images available , personally I can't vouch for any of them. 有一些容器图像可用 ,我个人不能保证其中任何一个。
Personally I'd probably build my own and download the latest kubectl
. 我个人可能会自己构建并下载最新的
kubectl
。 A Dockerfile like this is probably a good starting point 这样的Dockerfile可能是一个很好的起点
FROM alpine:latest
RUN apk --no-cache add curl
RUN curl https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl -o /usr/local/bin/kubectl
RUN chmod +x /usr/local/bin/kubectl
This will build you a container image with kubectl
, so you can then all the kubectl
commands you want. 这将使用
kubectl
构建一个容器映像,这样您便可以使用所有想要的kubectl
命令。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.