Skip to content

Instantly share code, notes, and snippets.

@mofelee mofelee/kube-command.md
Last active Aug 10, 2017

Embed
What would you like to do?

映射scope服务到本地

kubectl port-forward -n kube-system "$(kubectl get -n kube-system pod --selector=weave-scope-component=app -o jsonpath='{.items..metadata.name}')" 4040

部署

kubectl run kubernetes-bootcamp --image=docker.io/jocatalin/kubernetes-bootcamp:v1 --port=8080

进入Pod 中执行命令

kubectl exec -ti $POD_NAME bash

暴露服务

kubectl expose deployment/kubernetes-bootcamp --type="NodePort" --port 8080

扩容服务

kubectl scale deployments/kubernetes-bootcamp --replicas=4

升级

kubectl set image deployments/kubernetes-bootcamp kubernetes-bootcamp=jocatalin/kubernetes-bootcamp:v2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.