当前位置:网站首页>[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
边栏推荐
- [my advanced OpenGL learning journey] learning notes of OpenGL coordinate system
- 日志记录真没你想的那么简单
- Nifi from introduction to practice (nanny level tutorial) - environment
- Leetcode notes of Google boss | necessary for school recruitment!
- Pytorch transpose convolution
- Still worried about missing measurements? Let's use Jacobo to calculate the code coverage
- 60 个神级 VS Code 插件!!
- Some adventurer hybrid versions with potential safety hazards will be recalled
- ZOJ——4104 Sequence in the Pocket(思维问题)
- How to open a futures account safely? Which futures companies are more reliable?
猜你喜欢

B. Ternary Sequence(思维+贪心)Codeforces Round #665 (Div. 2)

Using oasis to develop a hop by hop (I) -- Scene Building

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)

构建Go命令行程序工具链
![[my advanced OpenGL learning journey] learning notes of OpenGL coordinate system](/img/21/48802245fea2921fd5e4a9a2d9ad18.jpg)
[my advanced OpenGL learning journey] learning notes of OpenGL coordinate system

一文理解OpenStack网络

60 divine vs Code plug-ins!!

Several common DoS attacks

Nifi from introduction to practice (nanny level tutorial) - environment
随机推荐
基于STM32的MD5校验
期货怎么开户安全些?哪些期货公司靠谱些?
对深度可分离卷积、分组卷积、扩张卷积、转置卷积(反卷积)的理解
Istio FAQ: return 426 status code
炒期货在哪里开户最正规安全?怎么期货开户?
sql 多表更新数据非常慢
Global and Chinese market for commercial barbecue smokers 2022-2028: Research Report on technology, participants, trends, market size and share
转置卷积详解
[log service CLS] Tencent cloud log4j/logback log collection best practices
MySQL日期时间戳转换
【面试高频题】难度 3/5,可直接构造的序列 DP 题
Cap: multiple attention mechanism, interesting fine-grained classification scheme | AAAI 2021
Global and Chinese markets of natural insect repellents 2022-2028: Research Report on technology, participants, trends, market size and share
Installer la Bibliothèque imagemagick 7.1 et l'extension imagick de PHP
B. Ternary Sequence(思维+贪心)Codeforces Round #665 (Div. 2)
Global and Chinese market of computer protective film 2022-2028: Research Report on technology, participants, trends, market size and share
Using oasis to develop a hop by hop (I) -- Scene Building
Interpretation of swin transformer source code
Using alicloud RDS for SQL Server Performance insight to optimize database load - first understanding of performance insight
Build go command line program tool chain