当前位置:网站首页>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
边栏推荐
- Alexnet model
- Llvm - generate for loop
- Explanation and example application of the principle of logistic regression in machine learning
- 1990年1月1日是星期一,定义函数date_to_week(year,month,day),实现功能输入年月日后返回星期几,例如date_to_week(2020,11,1),返回:星期日。 提示:
- The win10 taskbar notification area icon is missing
- LeetCode165-比较版本号-双指针-字符串
- Leetcode153 - find the minimum value in the rotation sort array - array - binary search
- LeetCode 练习——396. 旋转函数
- Byte interview programming question: the minimum number of K
- setcontext getcontext makecontext swapcontext
猜你喜欢
![Detailed explanation of C language knowledge points -- first understanding of C language [1] - vs2022 debugging skills and code practice [1]](/img/07/c534238c2b5405bbe4655e51cfee51.png)
Detailed explanation of C language knowledge points -- first understanding of C language [1] - vs2022 debugging skills and code practice [1]

The wechat applet optimizes the native request through the promise of ES6

1n5408-asemi rectifier diode

LeetCode153-寻找旋转排序数组中的最小值-数组-二分查找

免费在upic中设置OneDrive或Google Drive作为图床

Leetcode165 compare version number double pointer string

Is asemi ultrafast recovery diode interchangeable with Schottky diode

nuxt项目:全局获取process.env信息

What is the effect of Zhongfu Jinshi wealth class 29800? Walk with professional investors to make investment easier

22年了你还不知道文件包含漏洞?
随机推荐
Set onedrive or Google drive as a drawing bed in upic for free
买卖股票的最佳时机系列问题
Leetcode149 - maximum number of points on a line - Math - hash table
Brute force of DVWA low -- > High
Sword finger offer (2) -- for Huawei
[proteus simulation] automatic range (range < 10V) switching digital voltmeter
Analysis of common storage types and FTP active and passive modes
A series of problems about the best time to buy and sell stocks
async void 导致程序崩溃
API gateway / API gateway (II) - use of Kong - load balancing
Share 20 tips for ES6 that should not be missed
Five data types of redis
How to use OCR in 5 minutes
JS - implémenter la fonction de copie par clic
Role of asemi rectifier module mdq100-16 in intelligent switching power supply
redis-shake 使用中遇到的错误整理
Ffmpeg installation error: NASM / yasm not found or too old Use --disable-x86asm for a clipped build
How to design a good API interface?
My raspberry PI zero 2W toss notes to record some problems and solutions
Introduction to Arduino for esp8266 serial port function