简体   繁体   中英

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.

I am using google container engine for my cluster.

How to configure the container inside the pod to be able to run commands like kubectl create deployment.yaml?

PS A bit clueless about it at the moment.

Your container is going to need to have kubectl available. 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 . A Dockerfile like this is probably a good starting point

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM