aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeependra Khare <nkhare@redhat.com>2015-01-27 15:58:32 +0000
committerBryn M. Reeves <bmr@redhat.com>2015-07-08 17:05:22 +0100
commit2ddc706c7219d0b891304fcb066dea865f8516b5 (patch)
tree5ef1a3aded4d1568b83c324eb83777bd070c5553
parentc0858c2c87f246283f6c59b7bf7f64f7dea73a82 (diff)
downloadsos-2ddc706c7219d0b891304fcb066dea865f8516b5.tar.gz
[kubernetes] add services and pod logs collection
Signed-off-by: Neependra Khare <nkhare@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r--sos/plugins/kubernetes.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/sos/plugins/kubernetes.py b/sos/plugins/kubernetes.py
index 289d7844..9c2df5e1 100644
--- a/sos/plugins/kubernetes.py
+++ b/sos/plugins/kubernetes.py
@@ -22,6 +22,8 @@ class kubernetes(Plugin, RedHatPlugin):
"""Kubernetes plugin
"""
+ option_list = [("podslog", "capture logs for pods", 'slow', False)]
+
def setup(self):
self.add_copy_spec("/etc/kubernetes")
self.add_copy_spec("/var/run/flannel")
@@ -30,9 +32,19 @@ class kubernetes(Plugin, RedHatPlugin):
self.add_cmd_output("kubectl version")
self.add_cmd_output("kubectl get -o json pods")
self.add_cmd_output("kubectl get -o json minions")
+ self.add_cmd_output("kubectl get -o json services")
self.add_cmd_output("kubectl get -o json replicationController")
self.add_cmd_output("kubectl get -o json events")
self.add_cmd_output("journalctl -r -u kubelet")
+ if self.get_option('podslog'):
+ result = self.get_command_output("kubectl get pods")
+ if result['status'] == 0:
+ for line in result['output'].splitlines()[1:]:
+ pod_name = line.split(" ")[0]
+ self.add_cmd_output([
+ "{0} log {1}".format("kubectl", pod_name)
+ ])
+
# vim: et ts=5 sw=4