当前位置:网站首页>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]#边栏推荐
- CTFSHOW权限维持篇
- 女朋友说:你要搞懂了MySQL三大日志,我就让你嘿嘿嘿!
- Achieve secure data sharing among multiple parties and solve the problem of asymmetric information in Inclusive Finance
- How to use dataant to monitor Apache APIs IX
- CesiumJS 2022^ 源码解读[6] - 三维模型(ModelExperimental)新架构
- 76 page comprehensive solution 2022 for smart Logistics Park (download attached)
- 76页智慧物流园区综合解决方案2022(附下载)
- 唯一性索引与逻辑删除冲突问题解决思路
- IFLYTEK active competition summary! (12)
- 基金销售行为规范及信息管理
猜你喜欢

Netease cloud sign in lottery? That year I could sign in for 365 days. No? Look.

Fastjson V2 simple user manual

Design e-commerce seckill system

How does the VR cloud exhibition hall bring vitality to offline entities? What are the functions?

206 page Shanghai BIM Technology Application and development report 2021

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

Fh6908a negative pole turn off synchronous rectification analog low voltage drop diode control IC chip tsot23-6 ultra low power rectifier 1W power consumption < 100ua static replacement mp6908

Bridge emqx cloud data to AWS IOT through the public network

什么是SRM系统,如何规范公司内部采购流程

Ideal interface automation project
随机推荐
Operation record of reinitialization instance of Dameng database
Ctfshow permission maintenance
企业出海数字化转型解决方案介绍
flutter - sort List排序
"Paddle + camera" has become a "prefabricated dish" in the AI world, and it is easier to implement industrial AI quality inspection
如何关闭一个开放的DNS解析器
Is it safe to choose mobile phone for stock trading account opening in Guangzhou?
The programmer's girlfriend gave me a fatigue driving test
5G智慧建筑解决方案2021
Warmup preheating learning rate "suggestions collection"
Manage edge browser settings (ie mode, homepage binding, etc.) through group policy in the enterprise
How do it outsourcing resident personnel position their pain points?
Five minutes to understand the exploratory test
Introduction to machine learning compilation course learning notes lesson 2 tensor program abstraction
[golang] golang implements the string interception function substr
Redis - 01 缓存:如何利用读缓存提高系统性能?
206页上海BIM技术应用与发展报告2021
The college entrance examination in 2022 is over. Does anyone really think programmers don't need to study after work?
微信支付WxPayPubHelper v3版 回调xml为空的原因
How to use dataant to monitor Apache APIs IX