kubectl创建简单的pod

简介: kubectl创建简单的pod

1.在master节点编写资源清单

[root@master1 yaml]# vim pod-first.yaml

2.上传打包好的docker文件,并解压

[root@node1 ~]# docker load -i xianchao-tomcat.tar.gz

3.kubectl更新资源清单

[root@master1 yaml]# kubectl apply -f pod-first.yaml

4.查看pod情况

[root@master1 yaml]# kubectl get pods -o wide -l app=tomcat-pod-first

#查看 pod 日志

kubectl logs pod-first

#查看 pod 里指定容器的日志

kubectl logs pod-first -c tomcat-first

#进入到刚才创建的 pod,刚才创建的 pod 名字是 web

kubectl exec -it pod-first -- /bin/bash

#假如 pod 里有多个容器,进入到 pod 里的指定容器,按如下命令:

kubectl exec -it pod-first -c tomcat-first -- /bin/bash

#通过 kubectl run 创建 Pod

[root@master1 yaml]# kubectl run tomcat --image=xianchao/tomcat-8.5-jre8:v1 --image-pull-policy='IfNotPresent' --port=8080

相关文章
|
9月前
|
Kubernetes 应用服务中间件 nginx
Kubernetes学习-深入Pod篇(一) 创建Pod,Pod配置文件详解
Kubernetes学习-深入Pod篇(一) 创建Pod,Pod配置文件详解
|
6月前
|
存储 Kubernetes 应用服务中间件
如何在 Kubernetes 中创建 Pod
【8月更文挑战第11天】
143 1
如何在 Kubernetes 中创建 Pod
|
Kubernetes Shell API
kubernetes-kubectl命令说明
本文基于kubernetes 1.5.2版本编写 kubectl kubectl controls the K8S cluster manager. Find more information at https://github.
1248 0
|
Kubernetes Perl 容器
【kubernetes】好用的 kubectl 命令
【kubernetes】好用的 kubectl 命令
136 1
|
Kubernetes Perl 容器
15-Kubernetes-Pod控制器详解-Deployment(Deploy)
15-Kubernetes-Pod控制器详解-Deployment(Deploy)
|
存储 Kubernetes 网络协议
K8S(1)Pod
K8S(1)Pod
131 0
|
Kubernetes Java Docker
K8s 中 Pod OOMKilled 原因
K8s 中 Pod OOMKilled 原因
650 0
|
存储 Kubernetes 应用服务中间件
k8s的pod详解
k8s的pod详解
229 0
|
存储 Kubernetes 调度
【K8S系列】Pod详解
【K8S系列】Pod详解
578 0
|
Kubernetes NoSQL 容灾
k8s pod 超详细总结
详细总结pod的相关知识点
280 0
k8s pod 超详细总结

热门文章

最新文章