当前位置:网站首页>Detailed explanation of kubernetes (IX) -- actual combat of creating pod with resource allocation list
Detailed explanation of kubernetes (IX) -- actual combat of creating pod with resource allocation list
2022-04-23 15:12:00 【Always a teenager】
Today I will continue to introduce Linux Operation and maintenance related knowledge , The main content of this paper is to create a resource allocation list Pod actual combat .
One 、 Preparation of resource allocation list
Above Kubernetes Detailed explanation ( 8、 ... and )——Kubernetes Resource allocation list in , We introduced Kubernetes Common fields of resource configuration list , today , Let's use the resource allocation list , To actually generate one Pod object , So as to show Kubernetes The role of the resource allocation list .
First , Let's create a resource configuration manifest file pod-demo-test.yaml, And write the following :
apiVersion: v1
kind: Pod
metadata:
name: pod-demo-test
namespace: default
labels:
label1: mypod1
label2: mypod2
spec:
containers:
- name: container
image: ikubernetes/myapp:v1
- name: busybox
image: busybox
command:
- "/bin/bash"
- "-c"
- "sleep 7200"
In this resource list , We define a Pod object , The previous contents are basically fixed , And already in Kubernetes Detailed explanation ( 8、 ... and )——Kubernetes Resource allocation list In this article, I introduced . Back spec Under the field , We mainly have containers Field of , This field defines the Pod Containers within resources ,name Field defines the name of the container ;image Field defines the image of the container ;command Field defines the command to be executed after the container is run . It can be seen that , In the Pod In the resource object , We define two containers , One is myapp, One is busybox.
After the resource object is configured , As shown below :
Two 、 Resource configuration list creation Pod
After the resource list is completed , We can create a..., based on the resource list Pod Resource object .
Carry out orders :
kubectl create -f pod-demo.test.yaml
Can make Kubernetes Create one according to the configuration of our resource list Pod object . In the above order ,-f Parameter specifies a file , Followed by the file name .
Be careful : What we're using here is YAML The format of ,YAML The format is very strict with spaces and indents , Therefore, we should pay special attention to !
The execution result of this command is as follows :
After the command is executed , We can check the Pod object , Carry out orders :
kubectl describe pods pod-demo-test
The execution result of this command is as follows :
3、 ... and 、 Mirror image and Pod Medium Command Relationship description
Last , Let's talk about the following images and Pod Medium Command The relationship between orders .
In the resource configuration list , We configured... Under the image command command , And it's actually Pod Under the resource list , We can also configure CMD( similar Command). And in the mirror and Pod We can also configure args Variable ( Yes in the mirror ENTRYPOINT). Mirror down and Pod Medium Command Command and args The parameter configuration relationship is as follows :
1、 If Pod No configuration in Command and args, Then... In the image is used CMD and ENTRYPOINT
2、 If Pod Set up in Command, But no args, Then use Pod Medium Command, Ignore... In the mirror CMD and ENTRYPOINT
3、 If Pod Only args, be args Give as a parameter to... In the mirror ENTRYPOINT Use .
4、 If Pod And in the image Command and args, So in the mirror CMD and ENTRYPINT Will be ignored ,Pod Medium Command and args Will be used .
Originality is not easy. , Reprint please explain the source :https://blog.csdn.net/weixin_40228200
版权声明
本文为[Always a teenager]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231507194557.html
边栏推荐
- Introduction to Arduino for esp8266 serial port function
- Leetcode153 - find the minimum value in the rotation sort array - array - binary search
- Tun model of flannel principle
- Alexnet model
- How does eolink help telecommuting
- Thinkphp5 + data large screen display effect
- Have you learned the basic operation of circular queue?
- What is the effect of Zhongfu Jinshi wealth class 29800? Walk with professional investors to make investment easier
- 牛客网数据库SQL实战详细剖析(26-30)
- 1990年1月1日是星期一,定义函数date_to_week(year,month,day),实现功能输入年月日后返回星期几,例如date_to_week(2020,11,1),返回:星期日。 提示:
猜你喜欢
Leetcode165 compare version number double pointer string
Have you learned the basic operation of circular queue?
Daily question - leetcode396 - rotation function - recursion
Role of asemi rectifier module mdq100-16 in intelligent switching power supply
Leetcode167 - sum of two numbers II - double pointer - bisection - array - Search
Is asemi ultrafast recovery diode interchangeable with Schottky diode
UML learning_ Day2
LeetCode 练习——396. 旋转函数
Thinkphp5 + data large screen display effect
API gateway / API gateway (II) - use of Kong - load balancing
随机推荐
Modify the default listening IP of firebase emulators
Comment eolink facilite le télétravail
Openfaas practice 4: template operation
The life cycle of key value in redis module programming
Leetcode exercise - 396 Rotation function
8.2 text preprocessing
免费在upic中设置OneDrive或Google Drive作为图床
Llvm - generate local variables
LeetCode167-两数之和II-双指针-二分-数组-查找
LeetCode149-直线上最多的点数-数学-哈希表
JUC学习记录(2022.4.22)
Advanced version of array simulation queue - ring queue (real queuing)
Redis主从同步
Tencent has written a few words, Ali has written them all for a month
让阿里P8都为之着迷的分布式核心原理解析到底讲了啥?看完我惊了
The win10 taskbar notification area icon is missing
Is asemi ultrafast recovery diode interchangeable with Schottky diode
Common interview questions of operating system:
牛客网数据库SQL实战详细剖析(26-30)
Introduction to Arduino for esp8266 serial port function