多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
### 创建资源对象 1. 根据yaml 配置文件一次性创建service、rc ` kubectl create -f my-service.yaml -f my-rc.yaml` 2. 查看资源对象 - 查看所有pod 列表 kubectl get pod -n <namespace> - 查看RC和service 列表 kubectl get rc,svc 3. 描述资源对象 - 显示Node的详细信息 kubectl describe node <node-name> - 显示Pod的详细信息 kubectl describe pod <pod-name> 4. 删除资源对象 - 基于pod.yaml 定义的名称删除pod kubectl delete -f pod.yaml - 删除所有包含某个label的pod 和service kubectl delete pod,svc -l name=<label-name> - 删除所有Pod kubectl delete pod --all 5. 执行容器的命令 - 执行pod 的date 命令 kubectl exec <pod-name> -- date - 通过bash 获得pod中某个容器的TTY,相当于登陆容器 kubectl exec -it <pod-name> -c <container-name> -- bash 6. 查看容器的日志 kubectl logs <pod-name>