- Kubernetes for Developers
- Joseph Heck
- 215字
- 2021-08-27 19:04:18
Pods with more than one container
Our examples have been simple so far, with a single container in a Pod. A Pod can have more than one container at a time, and the command to get the logs can specify which container to use. If there is only one container, you don’t need to specify which one to use.
If you need to specify a specific container, you can do so with either the -c option, or by adding it onto the logs command. For example, if you had a Pod named webapp with two containers, flask and background, and you wanted to see the logs from the background container, you could use the kubectl logs webapp background or kubectl logs webapp -c background commands.
Likewise, there's a shortcut for defining Pods and containers within a deployment. Rather than specifying the full Pod name based on the names assigned through Kubernetes, you can prefix the name of the Pod with just the deployment name. For example, if we had created a deployment with the kubectl run flask image=… command from our earlier examples, we could use the following command:
kubectl logs deployment/flask
This is rather than looking up the specific Pod name and then asking for the logs based on that name.
- Managing Mission:Critical Domains and DNS
- Getting Started with Clickteam Fusion
- 傳感器技術實驗教程
- Dreamweaver 8中文版商業案例精粹
- 輕松學Java
- CSS全程指南
- 數據庫原理與應用技術
- JBoss ESB Beginner’s Guide
- Windows環境下32位匯編語言程序設計
- 數據庫系統原理及應用教程(第5版)
- Visual Basic.NET程序設計
- INSTANT Heat Maps in R:How-to
- Mastering Exploratory Analysis with pandas
- Dreamweaver+Photoshop+Flash+Fireworks網站建設與網頁設計完全實用
- 設計模式