当前位置:网站首页>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]#边栏推荐
- Five minutes to understand the exploratory test
- conv2d详解--在数组和图像中的使用
- 2022-06-30: what does the following golang code output? A:0; B:2; C: Running error. package main import “fmt“ func main()
- MaxPool2d详解--在数组和图像中的应用
- hot-fix、cherry-pick怎么提
- Ctfshow framework reproduction
- Matlab saves triangulation results as STL files
- 35 giant technology companies jointly form the meta universe standard Forum Organization
- 如何关闭一个开放的DNS解析器
- 基金管理人公司治理和风险管理
猜你喜欢

Solution to the conflict between unique index and logical deletion

Combining online and offline, VR panorama is a good way to transform furniture online!

Makefile notes (Yiwen Institute makefile)

shell 同时执行多任务下载视频

206 page Shanghai BIM Technology Application and development report 2021

ABAQUS 2022 software installation package and installation tutorial

KubeVela 1.4:让应用交付更安全、上手更简单、过程更透明

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

The college entrance examination in 2022 is over. Does anyone really think programmers don't need to study after work?

Development of wireless U-shaped ultrasonic electric toothbrush
随机推荐
How to use robots Txt and its detailed explanation
Explain kubernetes backup and recovery tools velero | learn more about carina series phase III
基金客户和销售机构
Error when starting PHP: [pool www] cannot get uid for user '@php_ fpm_ [email protected]’
Maxpool2d explanation -- Application in arrays and images
Is it safe to open a stock account of Huatai Securities online?
微信支付WxPayPubHelper v3版 回调xml为空的原因
Solution to the conflict between unique index and logical deletion
Lombok
flutter - sort List排序
异步過渡方案—Generator
How to edit special effects in VR panorama? How to display detailed functions?
Software supply chain security risk pointing North for enterprise digitalization and it executives
Redis - 01 缓存:如何利用读缓存提高系统性能?
Why did kubernetes win? The changes in the container circle!
How to open a stock account? Is it safe to open a mobile account
Repetition is the mother of skill
LVM snapshot: backup based on LVM snapshot
New trends of China's national tide development in 2022
CentOS 6.3 x64 PHP 5.2.6 扩展安装OpenSSL出错的解决方法