当前位置:网站首页>Kubernetes practical skill: entering container netns
Kubernetes practical skill: entering container netns
2022-06-24 12:34:00 【imroc】
This article excerpts from kubernetes Learning notes
background
We use Kubernetes Some network problems are inevitable , It is often necessary to enter the network namespace of the container (netns) in , Do some network debugging to locate the problem , This article describes how to enter the container netns.
Get the container ID
Use kubectl obtain pod In any cotnainer Of id:
kubectl -n test describe pod debug-685b48bcf5-ggn5d
Output sample clip 1 (containerd Runtime ):
Containers:
debug:
Container ID: containerd://529bbd5c935562a9ba66fc9b9ffa95d486c6324f26d8253d744ffe3dfd728289Output sample clip 2 (dockerd Runtime ):
Containers:
debug:
Container ID: docker://e64939086488a9302821566b0c1f193b755c805f5ff5370d5ce5e6f154ffc648 obtain PID
Get container id after , We log in to pod Get its main process from the node pid.
containerd Run time usage crictl Command acquisition :
$ crictl inspect 529bbd5c935562a9ba66fc9b9ffa95d486c6324f26d8253d744ffe3dfd728289 | grep -i pid
"pid": 2266462,
"pid": 1
"type": "pid"In this case pid by 2266462
dockerd Run time usage docker Command acquisition :
$ docker inspect e64939086488a9302821566b0c1f193b755c805f5ff5370d5ce5e6f154ffc648 | grep -i pid
"Pid": 910351,
"PidMode": "",
"PidsLimit": 0,In this case pid by 910351
Use nsenter Into the container netns
Use... On nodes nsenter Get into pod Of netns:
nsenter -n --target 910351
Debug network
Successfully entered the netns, You can use the network tools on the node to debug the network , You can use... First ip a To validate the ip Whether the address is pod ip:
$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
3: [email protected]: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether 6a:c6:6f:67:dd:6c brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 172.18.0.67/26 brd 172.18.0.127 scope global eth0
valid_lft forever preferred_lft foreverIf you want to capture packets, you can also use the tcpdump Tool grab bag .
边栏推荐
- Chenglixin research group of Shenzhen People's hospital proposed a new method of multi group data in the diagnosis and prognosis analysis of hepatocellular carcinoma megps
- Tsingsee green rhino video "cloud side end" +ai intelligent security system is integrated into the mainstream development trend
- Use the object selection tool to quickly create a selection in Adobe Photoshop
- Embedded must learn! Detailed explanation of hardware resource interface - based on arm am335x development board (Part 1)
- Single gene pan cancer + simple experiment can be published 7 points+
- What is the reason why the video intelligent analysis platform easycvr is locally controllable but the superior equipment cannot control the subordinate equipment?
- How to write controller layer code gracefully?
- [day ui] alert component learning
- Linker --- linker
- Collation of related papers on root cause analysis
猜你喜欢
Database migration tool flyway vs liquibase (II)
[mysql_16] variables, process control and cursors

Opencv learning notes - Discrete Fourier transform

How can a shell script (.Sh file) not automatically close or flash back after execution?
Cloud native database: the outlet of the database, you can also take off

How stupid of me to hire a bunch of programmers who can only "Google"!
Deep parsing and implementation of redis pub/sub publish subscribe mode message queue

How is the e-commerce red envelope realized? For interview (typical high concurrency)

Opencv learning notes - regions of interest (ROI) and image blending

MySQL 外键影响
随机推荐
Embedded must learn! Detailed explanation of hardware resource interface - based on arm am335x development board (Part 2)
深度学习~11+高分疾病相关miRNA研究新视角
5分+的单基因泛癌纯生信思路!
VaR in PHP_ export、print_ r、var_ Differences in dump debugging
From theory to practice, decipher Alibaba's internal MySQL optimization scheme in simple terms
数据标注科普:十种常见的图像标注方法
Single gene pan cancer + simple experiment can be published 7 points+
Clickhouse uses distributed join of pose series
mRNA疫苗的研制怎么做?27+ 胰腺癌抗原和免疫亚型的解析来告诉你答案!
Remote terminal RTU slope monitoring and early warning
Concentrate on research preparation, Tencent cloud, see you next year!
《回归故里》阅读笔记
Kubernetes best practice: graceful termination
The idea of "6 points + gene family" without experiment~
Pipeline post instruction
基于AM335X开发板 ARM Cortex-A8——Acontis EtherCAT主站开发案例
[tke] GPU node NVIDIA Tesla driver reinstallation
As one of the bat, what open source projects does Tencent have?
Flink snapshot analysis: operators for locating large states and data skew
[5 minutes to play lighthouse] create an immersive markdown writing environment