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 调度
【K8S系列】Pod详解
【K8S系列】Pod详解
186 0
|
11月前
|
存储 Kubernetes Docker
k8s--pod 介绍
k8s--pod 介绍
k8s--pod 介绍
|
2月前
|
Kubernetes Perl 容器
在 Kubernetes 中重启 pod 的 3 种方法
【4月更文挑战第25天】
861 1
在 Kubernetes 中重启 pod 的 3 种方法
|
2月前
|
Kubernetes 应用服务中间件 nginx
Kubernetes学习-深入Pod篇(一) 创建Pod,Pod配置文件详解
Kubernetes学习-深入Pod篇(一) 创建Pod,Pod配置文件详解
|
2月前
|
JSON Kubernetes 数据安全/隐私保护
Kubectl
Kubectl 是一个命令行工具,用于管理 Kubernetes 集群。它可以用来创建、删除、更新和查询 Kubernetes 资源,例如部署、服务、副本集等。Kubectl 提供了丰富的命令和选项,可以满足各种管理需求。
48 3
|
2月前
|
Kubernetes 容器
kubectl 操作deployment 的常用命令
kubectl 是 Kubernetes 的命令行工具,用于管理和操作 Kubernetes 集群。以下是一些常用的 kubectl 命令用于操作 Deployment: 1. 创建一个 Deployment: ``` kubectl create deployment <deployment-name> --image=<image-name> ``` 2. 查看 Deployment 列表: ``` kubectl get deployments ``` 3. 查看 Deployment 的详细信息: ``` kubectl de
270 0
|
7月前
|
Kubernetes Java Docker
K8s 中 Pod OOMKilled 原因
K8s 中 Pod OOMKilled 原因
321 0
|
10月前
|
Kubernetes 网络协议 Perl
Kubernetes 优雅终止 pod
Kubernetes 优雅终止 pod
112 1
|
11月前
|
存储 Kubernetes 应用服务中间件
k8s的pod详解
k8s的pod详解
154 0
|
12月前
|
Kubernetes Perl 容器
15-Kubernetes-Pod控制器详解-Deployment(Deploy)
15-Kubernetes-Pod控制器详解-Deployment(Deploy)