kubernete的资料

  1. 10分钟入门
    http://www.dockone.io/article/932

  2. 官方教程,包含可以互动命terminal
    https://kubernetes.io/docs/tutorials/kubernetes-basics/

根据上面的教程,总结的kubectl命令:

minikube version
minikube start
minikube ip

kubectl version
kubectl cluster-info
kubectl get pods 
kubectl get pods -o wide
kubectl get nodes
kubectl get services (查看暴露端口)
kubectl get deployments (查看部署了那些app)
kubectl get pods -l run=kubernetes-bootcamp
kubectl get services -l run=kubernetes-bootcamp
kubectl describe pods
kubectl describe nodes
kubectl describe deployments/kubernetes-bootcamp



kubectl proxy
curl http://localhost:8001/version
curl http://localhost:8001/api/v1/proxy/namespaces/default/pods/$POD_NAME/

kubestl logs $POD_NAME

kubectl exec $POD_NAME env
kubectl exec -it $POD_NAME bash
kubectl exec -it $POD_NAME curl localhost:8080

kubectl expose deployment/kubernetes-bootcamp --type="NodePort" --port 8080
kubectl delete service -l run=kubernetes-bootcamp

kubectl label pod $POD_NAME app=v1

kubectl run kubernetes-bootcamp --image=gcr.io/google-samples/kubernetes-bootcamp:v1 --port=8080
kubectl scale deployments/kubernetes-bootcamp --replicas=4

kubectl set image deployments/kubernetes-bootcamp kubernetes-bootcamp=jocatalin/kubernetes-bootcamp:v2
kubectl rollout status deployments/kubernetes-bootcamp
kubectl rollout undo deployments/kubernetes-bootcamp

kubectl get pods -o go-template --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}'
kubectl get pods -o go-template --template '{{range .items}}{{"\n"}}{{end}}'
kubectl get pods -o go-template --template '{{.metadata.name}}{{"\n"}}{{end}}'

export POD_NAME=$(kubectl get pods -o go-template --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')
export NODE_PORT=$(kubectl get services/kubernetes-bootcamp -o go-template='{{(index .spec.ports 0).nodePort}}')


你可能感兴趣的:(kubernete的资料)