当前位置:网站首页>[tke] troubleshooting tips for container problems
[tke] troubleshooting tips for container problems
2022-06-24 16:17:00 【jokey】
1. There is no... In the container environment shell Environmental Science
Sometimes we want to see something inside the container , But there is no container shell execution environment , For example, I want to see coredns In the container /etc/resolv.conf Whether the content of inherits the configuration of the node correctly , The simple operation steps are as follows ( With docker Take the runtime example ):
Log in to the node where the container is located , perform docker ps Find the coredns Containers ID, And then use cp The command copies the file and you can see it :
docker ps | grep < Container name > docker cp < Containers ID>:/want/to/see/dir .
2. Common troubleshooting commands
1. see kubelet Guard service log ( The runtime log is similar to )
# Find out about daemon service systemctl list-units | grep <DAEMON_SERVICE_NAME> # Show kubelet Scroll through the logs journalctl -u kubelet -f # export kubelet Log to file journalctl -u kubelet > k.log # see kubelet 2 Log from hours ago to now journalctl -u kubelet --since "2 hours ago" | less
2. Get the current resource configuration YAML
kubectl get <RESOURCE> <POD_NAME> -n <NAMESPACE> -o yaml Order sample : kubectl get pod nginx-xxx -n default -o yaml kubectl get deploy nginx -n default -o yaml
3. View the current status description of the resource
kubectl describe <RESOURCE> <POD_NAME> -n <NAMESPACE> Order sample : kubectl describe pod nginx-xxx -n default kubectl describe pvc nginx -n default
4. View container log
# Dynamic refresh view Pod After the specified container in 20 Line logs kubectl logs <POD_NAME> -c <CONTAINER_NAME> --tail 20 -f -n <NAMESPACE> Order sample : kubectl logs nginx-xxx -c nginx --tail 20 -f -n default
5. Print out the field value specified by the resource (YAML structure )
kubectl get <RESOURCE> -o custom-columns=<ALIAS_NAME_1>:<RESOURCE_KEY_1>,<ALIAS_NAME_2>:<RESOURCE_KEY_2> Order sample : # Print... In resources separately .metadata.name( Alias Name),.status.eniInfos( Alias eni) field value . kubectl get nec -ocustom-columns=Name:.metadata.name,eni:.status.eniInfos # If there is... In the field "." Symbol , Need to be used as a whole "" Expand and translate , such as "tke.cloud.tencent.com/eni-ip" It's written in "tke\.cloud\.tencent\.com/eni-ip" kubectl get no -o=custom-columns=NAME:.metadata.name,Allocatable_eni-ip:.status.allocatable."tke\.cloud\.tencent\.com/eni-ip"
6. Use kubectl Execute container command
kubectl exec -it <POD_NAME> -c <CONTAINER_NAME> -n <NAMESPACE> -- <COMMAND> Order sample : kubectl exec -it nginx-xxx -c nginx -n default -- sh kubectl exec -it nginx-xxx -c nginx -n default -- sleep 100000
7. Use kubectl Create the test Pod
kubectl run busybox --image=busybox --overrides='{ "spec": { "nodeName": "<NODE_NAME>" } }' --command -- sleep 100000
Order sample :
# test Pod Run on the specified node "10.0.5.3" On
kubectl run busybox --image=busybox --overrides='{ "spec": { "nodeName": "10.0.5.3" } }' --command -- sleep 1000008. more kubectl Command usage
kubectl Commands are used in various ways : kubectl --help
3. Common packet capture commands
tcpdump -i <INTERFACE_NAME> host <HOST> and port <PORT> -nve Order sample : # Check in eth0 Interface ip by 8.8.8.8, The port number is 53 Non domain name display details package tcpdump -i eth0 host 8.8.8.8 and port 53 -nvve # Check in eth0 Interface src ip by 8.8.8.8, dst ip by 1.1.1.1 Non domain name display details package tcpdump -i eth0 src 8.8.8.8 and dst 1.1.1.1 -nvve # Use Wireshark Analyze the complete message file dns.pcap tcpdump -i eth0 host 8.8.8.8 and port 53 -s 0 -w dns.pcap
边栏推荐
- Interpretation of swin transformer source code
- SQL multi table updating data is very slow
- 构建Go命令行程序工具链
- Little red book, hovering on the edge of listing
- Understanding of deep separable convolution, block convolution, extended convolution, transposed convolution (deconvolution)
- 一文详解JackSon配置信息
- Siggraph 2022 | truly restore the hand muscles. This time, the digital human hands have bones, muscles and skin
- B. Terry sequence (thinking + greed) codeforces round 665 (Div. 2)
- Goby+AWVS 实现攻击面检测
- 对深度可分离卷积、分组卷积、扩张卷积、转置卷积(反卷积)的理解
猜你喜欢

用 Oasis 开发一个跳一跳(一)—— 场景搭建

实现领域驱动设计 - 使用ABP框架 - 领域逻辑 & 应用逻辑

Still worried about missing measurements? Let's use Jacobo to calculate the code coverage

C. K-th not divisible by n (Mathematics + thinking) codeforces round 640 (Div. 4)

One article explains Jackson configuration information in detail
![[C language questions -- leetcode 12 questions] take you off and fly into the garbage](/img/ca/a356a867f3b7ef2814080fb76b9bfb.png)
[C language questions -- leetcode 12 questions] take you off and fly into the garbage

Cap: multiple attention mechanism, interesting fine-grained classification scheme | AAAI 2021

使用阿里云RDS for SQL Server性能洞察优化数据库负载-初识性能洞察

SIGGRAPH 2022 | 真实还原手部肌肉,数字人双手这次有了骨骼、肌肉、皮肤

Siggraph 2022 | truly restore the hand muscles. This time, the digital human hands have bones, muscles and skin
随机推荐
B. Terry sequence (thinking + greed) codeforces round 665 (Div. 2)
MySQL日期时间戳转换
中国产品经理的没落:从怀恋乔布斯开始谈起
Global and Chinese market of inverted syrup 2022-2028: Research Report on technology, participants, trends, market size and share
Leetcode 139. Mot break word Split (medium)
安装ImageMagick7.1库以及php的Imagick扩展
Global and Chinese market of computer protective film 2022-2028: Research Report on technology, participants, trends, market size and share
A new weapon to break the memory wall has become a "hot search" in the industry! Persistent memory enables workers to play with massive data + high-dimensional models
Transpose convolution learning notes
[application recommendation] the hands-on experience and model selection suggestions of apifox & apipost in the recent fire
一文详解JackSon配置信息
Fastjson 漏洞利用技巧
B. Ternary Sequence(思维+贪心)Codeforces Round #665 (Div. 2)
[interview high frequency questions] sequential DP questions with difficulty of 3/5 and direct construction
60 divine vs Code plug-ins!!
【prometheus】1. Monitoring overview
April 23, 2021: there are n cities in the TSP problem, and there is a distance between any two cities
How to obtain ECS metadata
2021-05-01: given an ordered array arr, it represents the points located on the X axis. Given a positive number k
leetcode 139. Word Break 單詞拆分(中等)