All Projects → wangjia184 → pod-inspector

wangjia184 / pod-inspector

Licence: other
A tool to inspect pods in kubernetes

Programming Languages

typescript
32286 projects
go
31211 projects - #10 most used programming language
HTML
75241 projects
CSS
56736 projects
shell
77523 projects
Dockerfile
14818 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to pod-inspector

Kubecontext
Menu Bar App for Managing Kubernetes Contexts on Mac
Stars: ✭ 244 (+287.3%)
Mutual labels:  kubernetes-setup, kubernetes-monitoring
Metalk8s
An opinionated Kubernetes distribution with a focus on long-term on-prem deployments
Stars: ✭ 217 (+244.44%)
Mutual labels:  kubernetes-setup, kubernetes-monitoring
jenkins kube brains
Example scripts to run Kubernetes on your private VMs. This is to support of Loren and my KubeCon 2018 talk "Migrating Jenkins to Kubernetes broke our brains." https://sched.co/GrSh
Stars: ✭ 34 (-46.03%)
Mutual labels:  kubernetes-setup
GPU-Kubernetes-Guide
How to setup a production-grade Kubernetes GPU cluster on Paperspace in 10 minutes for $10
Stars: ✭ 34 (-46.03%)
Mutual labels:  kubernetes-setup
kubernetes-cluster
Vagrant As Automation Script
Stars: ✭ 34 (-46.03%)
Mutual labels:  kubernetes-setup
kubewatch
Kubernetes API event watcher
Stars: ✭ 33 (-47.62%)
Mutual labels:  kubernetes-monitoring
KubeScrape
KubeScrape: An open-source dev tool that provides an intuitive way to view the health, structure, and live metrics of your Kubernetes cluster
Stars: ✭ 133 (+111.11%)
Mutual labels:  kubernetes-monitoring
django-on-k8s
An end to end tutorial to run a Django Web Application having a PostgreSQL database in Kubernetes
Stars: ✭ 37 (-41.27%)
Mutual labels:  kubernetes-setup
kube-notary
A Kubernetes watchdog for verifying image trust with Codenotary (www.codenotary.com)
Stars: ✭ 55 (-12.7%)
Mutual labels:  kubernetes-monitoring
terraform-aws-minikube
Terraform module for single node Kubernetes instance bootstrapped using kubeadm
Stars: ✭ 58 (-7.94%)
Mutual labels:  kubernetes-setup
k8s-argus
Automated Kubernetes monitoring.
Stars: ✭ 35 (-44.44%)
Mutual labels:  kubernetes-monitoring
Prometheus-grafana
Monitor your Kubernetes cluster resources and applications
Stars: ✭ 21 (-66.67%)
Mutual labels:  kubernetes-monitoring
icp-ce-on-linux-containers
Multi node IBM Cloud Private Community Edition 3.2.x w/ Kubernetes 1.13.5 in a Box. Terraform, Packer and BASH based Infrastructure as Code script sets up a multi node LXD cluster, installs ICP-CE and clis on a metal or VM Ubuntu 18.04 host.
Stars: ✭ 52 (-17.46%)
Mutual labels:  kubernetes-setup
aws-kubernetes
Kubernetes cluster setup in AWS using Terraform and kubeadm
Stars: ✭ 32 (-49.21%)
Mutual labels:  kubernetes-setup
efk-stack-helm
Helm chart to deploy a working logging solution using the ElasticSearch - Fluentd - Kibana stack on Kubernetes
Stars: ✭ 51 (-19.05%)
Mutual labels:  kubernetes-monitoring
kubernetes-ami
A simple AMI and CloudFormation for launching Kubernetes on AWS
Stars: ✭ 41 (-34.92%)
Mutual labels:  kubernetes-setup
kubernetes the easy way
Automating Kubernetes the hard way with Vagrant and scripts
Stars: ✭ 22 (-65.08%)
Mutual labels:  kubernetes-setup
K8s-Cluster-Provisioner-GCP-Terrafrom
This repo will seamlessly setup self managed Kubernetes cluster in GCP using Terraform and Kubespray.
Stars: ✭ 17 (-73.02%)
Mutual labels:  kubernetes-setup
rak8s
Stand up a Raspberry Pi based Kubernetes cluster with Ansible
Stars: ✭ 362 (+474.6%)
Mutual labels:  kubernetes-setup
k8stream
Processing kubenetes events stream
Stars: ✭ 32 (-49.21%)
Mutual labels:  kubernetes-monitoring

Kubernetes Pod Inspector

Unlike other dashboardes for Kubernetes(Lens / Rancher / etc), Kubernetes Pod Inspector allows to check the file system and processes within running Linux pods without using kubectl. This is useful when we want to check the files within volumes mounted by pods

How to Deploy

The docker image is available at docker.io/wangjia184/pod-inspector. Typically, it can be deployed into K8S cluster with following yaml.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: pod-inspector-deployment
  labels:
    app: pod-inspector
spec:
  replicas: 1
  selector:
    matchLabels:
      app: pod-inspector
  template:
    metadata:
      labels:
        app: pod-inspector
    spec:
      containers:
      - name: pod-inspector
        image: docker.io/wangjia184/pod-inspector:latest
        args: ["-port", "8080", "-user", "", "-password", ""]
        ports:
        - containerPort: 8080 
        env:
          - name: K8S_NODE_NAME
            valueFrom:
              fieldRef:
                fieldPath: spec.nodeName
          - name: NODE_IP
            valueFrom:
              fieldRef:
                fieldPath: status.hostIP
          - name: POD_NAME
            valueFrom:
              fieldRef:
                fieldPath: metadata.labels['statefulset.kubernetes.io/pod-name']
          - name: POD_NAMESPACE
            valueFrom:
              fieldRef:
                fieldPath: metadata.namespace
          - name: POD_IP
            valueFrom:
              fieldRef:
                fieldPath: status.podIP
          - name: POD_SERVICE_ACCOUNT
            valueFrom:
              fieldRef:
                fieldPath: spec.serviceAccountName
        imagePullPolicy: Always

It listens on port 8080 for HTTP service. You can specify user and password in arguments to enable http authentication.

Next, expose port 8080 so that you can access it. Here is an example:

apiVersion: v1
kind: Service
metadata:
  name: pod-inspector
spec:
  selector:
    app: pod-inspector
  ports:
    - name: http
      protocol: TCP
      port: 80
      targetPort: 8080
  type: ClusterIP
---
  apiVersion: networking.k8s.io/v1
  kind: Ingress
  metadata:
    name: pod-inspector
  spec:
    rules:
    - host: your.kubernetes.cluster.domain-name.local
      http:
        paths:
        - path: /
          pathType: Prefix
          backend:
            service:
              name: pod-inspector
              port:
                number: 80

Finally you should be able to access the web site. By filling the token and namespace of K8S cluster, it will connect to the same cluster the pod is running. Token can be retrieved in ~/.kube/config file.

Use a dedicated service account

If your cluster uses RBAC, you can also run the inspector with a dedicated service account and grant proper roles in order to use in-cluster token assigned from the service account. Here is an example to create the service account and its role.

apiVersion: v1
kind: ServiceAccount
metadata:
  name: pod-inspector
automountServiceAccountToken: true
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: pod-inspector
rules:
- apiGroups: [""] # "" indicates the core API group
  resources: ["pods"]
  verbs: ["get", "watch", "list"]
- apiGroups: [""]
  resources: ["pods/exec"]
  verbs: ["create"]
- apiGroups: ["metrics.k8s.io"]
  resources: ["pods", "nodes"]
  verbs: ["get", "watch", "list"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: inspect-pods
subjects:
- kind: ServiceAccount
  name: pod-inspector # service account name
roleRef:
  kind: Role
  name: pod-inspector # role name
  apiGroup: rbac.authorization.k8s.io

Then specifiy the service account in your pod.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: pod-inspector-deployment
  labels:
    app: pod-inspector
spec:
  replicas: 1
  selector:
    matchLabels:
      app: pod-inspector
  template:
    metadata:
      labels:
        app: pod-inspector
    spec:
      serviceAccountName: pod-inspector # service account
      containers:
      - name: pod-inspector
        image: docker.io/wangjia184/pod-inspector:latest
        args: ["-port", "8080", "-user", "admin", "-password", "654321"]
        ports:
        - containerPort: 8080 
        env:
          - name: K8S_NODE_NAME
            valueFrom:
              fieldRef:
                fieldPath: spec.nodeName
          - name: NODE_IP
            valueFrom:
              fieldRef:
                fieldPath: status.hostIP
          - name: POD_NAME
            valueFrom:
              fieldRef:
                fieldPath: metadata.labels['statefulset.kubernetes.io/pod-name']
          - name: POD_NAMESPACE
            valueFrom:
              fieldRef:
                fieldPath: metadata.namespace
          - name: POD_IP
            valueFrom:
              fieldRef:
                fieldPath: status.podIP
          - name: POD_SERVICE_ACCOUNT
            valueFrom:
              fieldRef:
                fieldPath: spec.serviceAccountName
        imagePullPolicy: Always

Screenshots

List of Pods

List of Pods

Files within Pods

Files within Pods

View File (or you can download as well)

Check Processes

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].