If you have multiple containers in your pod you can choose the container to view using the -c flag.īy default, kubectl logs lists the current logs and exits. You can use the following to see the logs for a running container: $ kubectl logs Kubectl also makes a number of commands available for debugging yourĬontainers. This will provide a rich multiline human-readable description of the object as well as any other relevant, related objects and events in the Object, use the describe command: $ kubectl describe If you are interested in more detailed information about a particular The complete details of JSONPath are beyond the scope of this chapter, but as an example, this command will extract and print the IP address of the pod: $ kubectl get pods my-pod -o jsonpath -template= kubectl uses the JSONPath query language to select fields in the returned object. If you specify the -no-headers flag, kubectl will skip the headers at the top of theĪnother common task is extracting specific fields from the object. Remove the headers, which is often useful when combining kubectl with If you want to view the complete object, you can also view the objects as raw JSON or YAML using the -o json or -o yaml flags, respectively.Ī common option for manipulating the output of kubectl is to One way to get slightly more information is to add the -o wide flag, which gives more details, on a longer line. Many of the details of the objects to fit each object on one terminal line. Responses from the API server, but this human-readable printer removes īy default, kubectl uses a human-readable printer for viewing the If you want to get a specific resource, you can use kubectl get. If you run kubectl get you will get a listing of all resources in the current namespace. The most basic command for viewing Kubernetes objects via kubectl is get. The kubectl command makes HTTP requests to these URLs to access the Kubernetes objects that reside at these paths. Each Kubernetes object exists at a unique HTTP path for example, leads to the representation of a pod in the default namespace named my-pod. Throughout this book, we refer to these resources as Kubernetes objects. Everything contained in Kubernetes is represented by a RESTful resource.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |