kubernetes popeye inspection

1 Introduction

Popeye is a utility that scans a live Kubernetes cluster and reports on potential issues with deployed resources and configurations. It cleans the cluster based on what's deployed rather than what's on disk. By scanning your cluster, it can detect misconfigurations and help you ensure best practices are in place to prevent future troubles. It is designed to reduce the cognitive overload faced when operating a Kubernetes cluster in the wild. Additionally, if your cluster uses metric-server, it will report potential over/under allocation of resources and try to warn you if your cluster is running low on capacity.

2. Installation

Download address: https://github.com/derailed/popeye/releases/tag/v0.11.1

wget https://github.com/derailed/popeye/releases/download/v0.11.1/popeye_Linux_x86_64.tar.gz
mkdir popeye 
mv popeye_Linux_x86_64.tar.gz popeye
cd popeye 
tar zxvf popeye_Linux_x86_64.tar.gz
cp popeye /usr/local/bin/

3. Local

POPEYE_REPORT_DIR=$(pwd) popeye --save
或者

POPEYE_REPORT_DIR=$(pwd) ./popeye --save --out html --output-file report.html

4. Container

You don't need to build and/or install binaries to run Popeye: you can run it directly from the official docker repo on DockerHub. The default command when running a docker container is popeye, so you only need to pass the cli parameters to popeye that you would normally pass to popeye. To access the cluster, use -v to map the local kube config directory into the container

  docker run --rm -it \
    -v $HOME/.kube:/root/.kube \
    derailed/popeye --context foo -n bar

Running the above docker command with –rm means the container will be deleted when popeye exits. When you save with -- it writes it to /tmp in the container and then deletes the container when popeye exits, meaning you lose the output. To resolve this issue, map /tmp to the container's /tmp. NOTE: You can override the default output directory location by setting the POPEYE_REPORT_DIR env variable.

  docker run --rm -it \
    -v $HOME/.kube:/root/.kube \
    -e POPEYE_REPORT_DIR=/tmp/popeye \
    -v /tmp:/tmp \
    derailed/popeye --context foo -n bar --save --output-file my_report.txt

  # Docker has exited, and the container has been deleted, but the file
  # is in your /tmp directory because you mapped it into the container
  $ cat /tmp/popeye/my_report.txt
    <snip>

Guess you like

Origin blog.csdn.net/xixihahalelehehe/article/details/133145380