当前位置:网站首页>[kubernetes series] pod chapter actual operation
[kubernetes series] pod chapter actual operation
2022-06-13 04:00:00 【Python's path to becoming a God】
Catalog
One 、 Command terminal
establish Pod
- Command format
kubectl run Customize pod name --image= base image
Example
[[email protected] kubernetes]# kubectl run my-nginx --image=nginx
pod/my-nginx created
see Pod
- Simple status information
[[email protected] ~]# kubectl get pod -n default
NAME READY STATUS RESTARTS AGE
my-nginx 1/1 Running 0 15s
- Pod Details
Command formatkubectl get pod podName -owide
[[email protected] ~]# kubectl get pod my-nginx -owide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
my-nginx 1/1 Running 0 2m30s 10.244.0.9 vm-4-8-centos <none> <none>
- Execution process description
Command formatkubectl describe pod podName
[[email protected] ~]# kubectl describe pod my-nginx
Name: my-nginx
Namespace: default
Priority: 0
Node: vm-4-8-centos/10.0.4.8
Start Time: Sat, 26 Feb 2022 11:25:56 +0800
Labels: run=my-nginx
Annotations: <none>
...
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 3m41s default-scheduler Successfully assigned default/my-nginx to vm-4-8-centos
Normal Pulling 3m41s kubelet Pulling image "nginx"
Normal Pulled 3m40s kubelet Successfully pulled image "nginx" in 882.15599ms
Normal Created 3m40s kubelet Created container my-nginx
Normal Started 3m40s kubelet Started container my-nginx
- Log information
Command formatkubectl logs podName
[[email protected] ~]# kubectl logs my-nginx
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
...
2022/02/26 03:25:57 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2022/02/26 03:25:57 [notice] 1#1: start worker processes
2022/02/26 03:25:57 [notice] 1#1: start worker process 31
2022/02/26 03:25:57 [notice] 1#1: start worker process 32
visit Pod Medium container
adopt kubectl get pod podName -owide Can get pod Of IP Address , Then you can access Pod Container process in ;
[[email protected] ~]# curl http://10.244.0.9
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
...
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>
Get into Pod Inside
- Command format :
kubectl exec -it podName -- /bin/bash
[[email protected] ~]# kubectl exec -it my-nginx -- /bin/bash
- modify Nginx Content , Revisit
[email protected]:/# cd /usr/share/nginx/html/
[email protected]:/usr/share/nginx/html# ll
bash: ll: command not found
[email protected]:/usr/share/nginx/html# ls
50x.html index.html
[email protected]:/usr/share/nginx/html# echo "welcome my nginx pod" > index.html

Delete Pod
- Command format :
kubectl delete pod Pod name -n Specify the namespace
[[email protected] kubernetes]# kubectl delete pod my-nginx -n default
pod "my-nginx" deleted
The configuration file yaml establish
- newly build
vi pod-demo.yaml
# The contents are as follows
apiVersion: v1
kind: Pod # The resource type ,Pod
metadata: # Metadata
name: nginx01 # Pod Custom name
namespace: default # Namespace
labels: # label
run: nginx01
spec: # Configuration information
containers: # Container group
- name: nginx01 # Container name
image: nginx # Specify the name of the underlying image or the warehouse connection
- Application profile
[[email protected] kubernetes]# kubectl apply -f pod-demo.yaml
- Delete the... Created by the configuration file Pod
Delete the configuration file at the same time , Delete... Together Pod
[[email protected] kubernetes]# kubectl delete -f pod-demo.yaml
Two 、Dashboard
establish Pod
Select in default namespace=default New China Pod, Select... In the control panel yaml Format file creation , The content is the same as the command terminal creation format ;

Pod You can view the contents in the menu 
Other operations will not be introduced in detail , I believe we can manage the graphical interface ~
Study Pod When , It should be clear to everyone that ,Pod It's a container group , It can contain multiple containers , So let's create a multi container Pod;
Create multi container Pod
newly added Tomcat Containers
apiVersion: v1
kind: Pod # The resource type ,Pod
metadata: # Metadata
name: pod-demo1 # Pod Custom name
namespace: default # Namespace
labels: # label
run: pod-demo1
spec: # Configuration information
containers: # Container group
- name: nginx # Container name
image: nginx # Specify the name of the underlying image or the warehouse connection
- name: tomcat
image: tomcat:8.5.68
After uploading , You can see our pod Already run 
Into the container
pod Each line of the catalog list The last three points drop-down list Choose from perform Enter the container of the operation ;
Access container applications

Visit separately Nginx and Tomcat;
Format podIP+ Container port
[[email protected] ~]# kubectl get pod pod-demo1 -owide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
pod-demo1 2/2 Running 0 9m37s 10.244.0.11 vm-4-8-centos <none> <none>
[[email protected] ~]# curl http://10.244.0.11
hello nginx
[[email protected] ~]# curl http://10.244.0.11:8080
<!doctype html><html lang="en"><head><title>HTTP Status 404 – Not Found</title><style type="text/css">body {
font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {
color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 404 – Not Found</h1><hr class="line" /><p><b>Type</b> Status Report</p><p><b>Description</b> The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.</p><hr class="line" /><h3>Apache Tomcat/8.5.68</h3></body></html>[[email protected] ~]#
边栏推荐
- 大疆无人机飞控系统的原理、组成及各传感器的作用
- Lambda终结操作查找与匹配findAny
- 单片机:EEPROM 多字节读写操作时序
- 单片机串口通信原理和控制程序
- 5G China unicom AP:B SMS ASCII 转码要求
- ROS topics and nodes
- [Yugong series] June 2022 Net architecture class 080 master cluster and database switching of distributed middleware schedulemaster
- Summary of meeting between president Ren and scientists and experts in system engineering
- Precautions for stream flow
- Lambda end operation find and match findany
猜你喜欢

【測試開發】自動化測試selenium(三)——unittest框架解析

Fundamentals of robot obstacle avoidance system

Unity shader learning 004 shader debugging platform difference third-party debugging tools
![[笔记]vs2015 编写汇编masm32之使用MASM32库](/img/f5/b47336af248d1b485208ec3f9ca12b.png)
[笔记]vs2015 编写汇编masm32之使用MASM32库

5G China unicom AP:B SMS ASCII 转码要求

Value of line height

EGO planner论文翻译

MCU: RS485 communication and Modbus Protocol

SCM signal generator program

OKR和KPI的区别
随机推荐
单片机:A/D 和 D/A 的基本概念
ROS中的msg消息
Line height equals height why not center
Meaning of different values of margin and padding
Single chip microcomputer: MODBUS multi computer communication program design
【测试开发】自动化测试selenium(二)——webdriver常用的API
扫地机器人如何才能避障不“智障”?五种主流的避障技术解析
Introduction to MCU peripherals: temperature sensor DS18B20
Among the four common technologies for UAV obstacle avoidance, why does Dajiang prefer binocular vision
Common array methods in JS (map, filter, foreach, reduce)
MCU: RS485 communication and Modbus Protocol
高等数学(第七版)同济大学 习题1-3 个人解答
Detailed explanation of MySQL storage process
Real time question answering of single chip microcomputer / embedded system
四旋翼飞行器避障系统基础
[test development] automated test selenium (III) -- unittest framework analysis
2022春学期总结
swap()
Lambda end operation collect
Lambda终结操作查找与匹配findFirst