当前位置:网站首页>Kubernetes ---- pod configuration container start command
Kubernetes ---- pod configuration container start command
2022-06-30 23:49:00 【Jerry00713】
One 、 Start command
1.1 Writing configuration files
establish pod_command.yaml file , And write the following , That is, after the container starts , towards 、opt/text.txt File write timestamp , Execute commands mainly through command Field in , The type is in list format
apiVersion: v1
kind: Namespace
metadata:
name: dev
---
apiVersion: v1
kind: Pod
metadata:
name: pod-command
namespace: dev
labels:
user: redrose2100
spec:
containers:
- name: busybox
image: busybox:1.30
command: ["/bin/sh","-c","touch /tmp/hello.txt;while true;do /bin/echo $(date +%T) >> /tmp/hello.txt;sleep 3;done;"]1.2 Create resources
Use the following command to create namespace and pod resources
[[email protected] pod]# kubectl apply -f pod_command.yaml
namespace/dev created
pod/pod-command created
[[email protected] pod]#1.3 Enter the container to check the data
as follows , Enter the container , And look at /tmp/hello.txt The contents of the document , as follows , Indicates that the command has been executed successfully
[[email protected] pod]# kubectl get pod -n dev
NAME READY STATUS RESTARTS AGE
pod-command 1/1 Running 0 6s
[[email protected] pod]# kubectl exec pod-command -n dev -it -c busybox /bin/sh
kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl exec [POD] -- [COMMAND] instead.
/ # tail -n 5 /tmp/hello.txt
15:13:58
15:14:01
15:14:04
15:14:07
15:14:10
/ #1.4 About kubernetes in command and args Parameter description of :
- If command and args Didn't write , Then use dockerfile Configuration in
- If command Yes , however args Not written , that dockerfile The default configuration is ignored , Execute the input command
- If command Not written , however args Yes , that dockerfile Configured in ENTRYPOINT Your orders will be executed , With the current args Parameters of
- If command and args It's all written , that dockerfile The configuration of is ignored , perform command On the additional args Parameters
1.5 Delete resources
Use the following command to delete the resource
[[email protected] pod]# kubectl delete -f pod_command.yaml
namespace "dev" deleted
pod "pod-command" deleted
[[email protected] pod]#边栏推荐
- MaxPool2d详解--在数组和图像中的应用
- How to edit special effects in VR panorama? How to display detailed functions?
- Bridge emqx cloud data to AWS IOT through the public network
- How does the VR cloud exhibition hall bring vitality to offline entities? What are the functions?
- 1175. 質數排列 / 劍指 Offer II 104. 排列的數目
- CentOS 6.3 x64 PHP 5.2.6 扩展安装OpenSSL出错的解决方法
- 6-1 exploit -ftp exploit
- Red hat will apply container load server on project atomic
- conv2d详解--在数组和图像中的使用
- 在指南针上买基金安全吗?
猜你喜欢

Makefile notes (Yiwen Institute makefile)

一次革命、两股力量、三大环节:《工业能效提升行动计划》背后的“减碳”路线图

8253A寄存器浅析

Bridge emqx cloud data to AWS IOT through the public network

Analysis of 8253a register

In 2022, the latest JCR officially released the list of the latest global impact factors (top 600)

HP 惠普笔记本电脑 禁用触摸板 在插入鼠标后

76 page comprehensive solution 2022 for smart Logistics Park (download attached)

企业出海数字化转型解决方案介绍
![[leetcode] [SQL] notes](/img/8d/160a03b9176b8ccd8d52f59d4bb47f.png)
[leetcode] [SQL] notes
随机推荐
5g smart building solution 2021
HP notebook disable touchpad after mouse is inserted
Kubevela 1.4: make application delivery safer, easier to use, and more transparent
What does it mean to open an account online? Is it safe to open an account online?
MIT doctoral dissertation optimization theory and machine learning practice
To tell you the truth, ThreadLocal is really not an advanced thing
Netease cloud sign in lottery? That year I could sign in for 365 days. No? Look.
1. crawler's beautifulsoup parsing library & online parsing image verification code
Design e-commerce seckill system
One revolution, two forces and three links: the "carbon reduction" road map behind the industrial energy efficiency improvement action plan
Gateway service gateway
DNS server setup, forwarding, master-slave configuration
Warmup preheating learning rate "suggestions collection"
1175. prime number arrangement / Sword finger offer II 104 Number of permutations
Introduction to digital transformation solutions for enterprises going to sea
conv2d详解--在数组和图像中的使用
Red Hat将在Project Atomic上运用容器负载服务器
1175. 質數排列 / 劍指 Offer II 104. 排列的數目
CesiumJS 2022^ 源码解读[6] - 三维模型(ModelExperimental)新架构
Cesiumjs 2022 ^ source code interpretation [6] - new architecture of modelempirical