当前位置:网站首页>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 .
边栏推荐
- Ten thousand campus developers play AI in a fancy way. It's enough to see this picture!
- Database migration tool flyway vs liquibase (II)
- How to check the situation that the national standard platform easygbs equipment video cannot be accessed by grabbing packets?
- Group planning - General Review
- The pod is evicted due to insufficient disk space of tke node
- 9+! Predicting lymph node status from histology of colorectal cancer by deep learning
- Opencv learning notes - Discrete Fourier transform
- A "full cloud" journey of a quasi financial system
- 使用开源工具 k8tz 优雅设置 Kubernetes Pod 时区
- How to make Baidu quickly include its own personal website?
猜你喜欢
![[go language questions] go from 0 to entry 4: advanced usage of slice, elementary review and introduction to map](/img/7a/16b481753d7d57f50dc8787eec8a1a.png)
[go language questions] go from 0 to entry 4: advanced usage of slice, elementary review and introduction to map

Opencv learning notes -- Separation of color channels and multi-channel mixing

一纸英雄帖,激起千层浪,横跨10国,一线大厂都派人来了!-GWEI 2022-新加坡

QT -- the qtabwidget supports dragging tabbar items

文本转语音功能上线,可以体验专业播音员的服务,诚邀试用

Group planning - General Review

FreeRTOS overview and experience

Linker --- linker

Ten thousand campus developers play AI in a fancy way. It's enough to see this picture!

微医CodeReview工具链
随机推荐
Practice of dynamic load balancing based on open source tars
How does the video networking / network penetration tool easynts permanently delete one of the devices?
How to check the situation that the national standard platform easygbs equipment video cannot be accessed by grabbing packets?
Hardware enterprise website ranking, 8 commonly used processes
About Adobe Photoshop adjusting selection
Ten thousand campus developers play AI in a fancy way. It's enough to see this picture!
Embedded must learn! Detailed explanation of hardware resource interface - based on arm am335x development board (Part 2)
Use the object selection tool to quickly create a selection in Adobe Photoshop
11+ article - machine learning builds Protics framework - deeply reveals the impact of tumor infiltrating immune cells in different molecular subtypes on prognosis
RTMP streaming platform easydss video on demand interface search bar development label fuzzy query process introduction
How can I open an account with new bonds? Is it safe
Tsingsee green rhino video "cloud side end" +ai intelligent security system is integrated into the mainstream development trend
文本转语音功能上线,可以体验专业播音员的服务,诚邀试用
The idea of "6 points + gene family" without experiment~
Popular science of data annotation: ten common image annotation methods
数据标注科普:十种常见的图像标注方法
Simple and flexible permission design?
Difference between X12 830 and 862 messages
Detailed explanation of the execution order of the expression and loop body in the for loop
Cluster control management