当前位置:网站首页>[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
边栏推荐
- Summary of common tools and usage
- Global and Chinese market of insect proof clothing 2022-2028: Research Report on technology, participants, trends, market size and share
- 微信公众号调试与Natapp环境搭建
- C. K-th Not Divisible by n(数学+思维) Codeforces Round #640 (Div. 4)
- 企业安全攻击面分析工具
- 安裝ImageMagick7.1庫以及php的Imagick擴展
- A memory leak caused by timeout scheduling of context and goroutine implementation
- Installer la Bibliothèque imagemagick 7.1 et l'extension imagick de PHP
- How does the effective date of SAP PP ECM affect the work order?
- 【云原生 | Kubernetes篇】Kubernetes基础入门(三)
猜你喜欢
![[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

C. K-th Not Divisible by n(数学+思维) Codeforces Round #640 (Div. 4)

Solution of intelligent all in one machine in expressway service area

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

我与“Apifox”的网络情缘

Logging is not as simple as you think
MySQL Advanced Series: Locks - Locks in InnoDB
MySQL Advanced Series: locks - locks in InnoDB

一文详解JackSon配置信息

C. K-th not divisible by n (Mathematics + thinking) codeforces round 640 (Div. 4)
随机推荐
Still worried about missing measurements? Let's use Jacobo to calculate the code coverage
日志记录真没你想的那么简单
[C language questions -- leetcode 12 questions] take you off and fly into the garbage
Two problems of qtreewidget returning as DLL in singleton mode
MySQL timestamp format conversion date format string
MySQL date timestamp conversion
Is Shanjin futures safe? What are the procedures for opening futures accounts? How to reduce the futures commission?
I just came back from the Ali software test. I worked for Alibaba P7 in 3+1, with an annual salary of 28*15
CAP:多重注意力机制,有趣的细粒度分类方案 | AAAI 2021
Linux record -4.22 MySQL 5.37 installation (supplementary)
B. Ternary Sequence(思维+贪心)Codeforces Round #665 (Div. 2)
[download attached] installation and simple use of Chinese version of awvs
[cloud native | kubernetes chapter] Introduction to kubernetes Foundation (III)
Several common DoS attacks
Fastjson 漏洞利用技巧
April 23, 2021: there are n cities in the TSP problem, and there is a distance between any two cities
【附下载】汉化版Awvs安装与简单使用
Transpose convolution learning notes
Several characteristics of pharmaceutical industry
国泰君安期货安全么?期货开户怎么开?期货手续费怎么降低?