πŸ‘€ A Kubernetes cluster resource sanitizer

Overview

Popeye - A Kubernetes Cluster Sanitizer

Popeye is a utility that scans live Kubernetes cluster and reports potential issues with deployed resources and configurations. It sanitizes your cluster based on what's deployed and not what's sitting on disk. By scanning your cluster, it detects misconfigurations and helps you to ensure that best practices are in place, thus preventing future headaches. It aims at reducing the cognitive overload one faces when operating a Kubernetes cluster in the wild. Furthermore, if your cluster employs a metric-server, it reports potential resources over/under allocations and attempts to warn you should your cluster run out of capacity.

Popeye is a readonly tool, it does not alter any of your Kubernetes resources in any way!




Go Report Card codebeat badge Build Status release License Docker Repository on Quay GitHub stars Releases


Installation

Popeye is available on Linux, OSX and Windows platforms.

  • Binaries for Linux, Windows and Mac are available as tarballs in the release page.

  • For OSX/Unit using Homebrew/LinuxBrew

    brew install derailed/popeye/popeye
  • Building from source Popeye was built using go 1.12+. In order to build Popeye from source you must:

    1. Clone the repo

    2. Add the following command in your go.mod file

      replace (
        github.com/derailed/popeye => MY_POPEYE_CLONED_GIT_REPO
      )
      
    3. Build and run the executable

      go run main.go

    Quick recipe for the impatient:

    # Clone outside of GOPATH
    git clone https://github.com/derailed/popeye
    cd popeye
    # Build and install
    go install
    # Run
    popeye

PreFlight Checks

  • Popeye uses 256 colors terminal mode. On `Nix system make sure TERM is set accordingly.

    export TERM=xterm-256color

Sanitizers

Popeye scans your cluster for best practices and potential issues. Currently, Popeye only looks at nodes, namespaces, pods and services. More will come soon! We are hoping Kubernetes friends will pitch'in to make Popeye even better.

The aim of the sanitizers is to pick up on misconfigurations, i.e. things like port mismatches, dead or unused resources, metrics utilization, probes, container images, RBAC rules, naked resources, etc...

Popeye is not another static analysis tool. It runs and inspect Kubernetes resources on live clusters and sanitize resources as they are in the wild!

Here is a list of some of the available sanitizers:

Resource Sanitizers Aliases
πŸ›€ Node no
Conditions ie not ready, out of mem/disk, network, pids, etc
Pod tolerations referencing node taints
CPU/MEM utilization metrics, trips if over limits (default 80% CPU/MEM)
πŸ›€ Namespace ns
Inactive
Dead namespaces
πŸ›€ Pod po
Pod status
Containers statuses
ServiceAccount presence
CPU/MEM on containers over a set CPU/MEM limit (default 80% CPU/MEM)
Container image with no tags
Container image using latest tag
Resources request/limits presence
Probes liveness/readiness presence
Named ports and their references
πŸ›€ Service svc
Endpoints presence
Matching pods labels
Named ports and their references
πŸ›€ ServiceAccount sa
Unused, detects potentially unused SAs
πŸ›€ Secrets sec
Unused, detects potentially unused secrets or associated keys
πŸ›€ ConfigMap cm
Unused, detects potentially unused cm or associated keys
πŸ›€ Deployment dp, deploy
Unused, pod template validation, resource utilization
πŸ›€ StatefulSet sts
Unsed, pod template validation, resource utilization
πŸ›€ DaemonSet ds
Unsed, pod template validation, resource utilization
πŸ›€ PersistentVolume pv
Unused, check volume bound or volume error
πŸ›€ PersistentVolumeClaim pvc
Unused, check bounded or volume mount error
πŸ›€ HorizontalPodAutoscaler hpa
Unused, Utilization, Max burst checks
πŸ›€ PodDisruptionBudget
Unused, Check minAvailable configuration pdb
πŸ›€ ClusterRole
Unused cr
πŸ›€ ClusterRoleBinding
Unused crb
πŸ›€ Role
Unused ro
πŸ›€ RoleBinding
Unused rb
πŸ›€ Ingress
Valid ing
πŸ›€ NetworkPolicy
Valid np
πŸ›€ PodSecurityPolicy
Valid psp

You can also see the full list of codes

Save the report

To save the Popeye report to a file pass the --save flag to the command. By default it will create a temp directory and will store the report there, the path of the temp directory will be printed out on STDOUT. If you have the need to specify the output directory for the report, you can use the environment variable POPEYE_REPORT_DIR. By default, the name of the output file follow the following format : sanitizer_<cluster-name>_<time-UnixNano>.<output-extension> (e.g. : "sanitizer-mycluster-1594019782530851873.html"). If you have the need to specify the output file name for the report, you can pass the --output-file flag with the filename you want as parameter.

Example to save report in working directory:

  $ POPEYE_REPORT_DIR=$(pwd) popeye --save

Example to save report in working directory in HTML format under the name "report.html" :

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

Save the report to S3

You can also save the generated report to an AWS S3 bucket with providing the flag --s3-bucket. As parameter you need to provide the name of the S3 bucket where you want to store the report. To save the report in a bucket subdirectory provide the bucket parameter as bucket/path/to/report.

Underlying the AWS Go lib is used which is handling the credential loading. For more information check out the official documentation.

Example to save report to S3:

popeye --s3-bucket=NAME-OF-YOUR-S3-BUCKET/OPTIONAL/SUBDIRECTORY --out=json

Run public docker image locally

You don't have to build and/or install the binary to run popeye: you can just run it directly from the official docker repo on quay.io. The default command when you run the docker container is popeye, so you just need to pass whatever cli args are normally passed to popeye. To access your clusters, map your local kube config directory into the container with -v :

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

Running the above docker command with --rm means that the container gets deleted when popeye exits. When you use --save, it will write it to /tmp in the container and then delete the container when popeye exits, which means you lose the output. To get around this, map /tmp to the container's /tmp. NOTE: You can override the default output directory location by setting POPEYE_REPORT_DIR env variable.

  docker run --rm -it \
    -v $HOME/.kube:/root/.kube \
    -e POPEYE_REPORT_DIR=/tmp/popeye \
    -v /tmp:/tmp \
    quay.io/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>

The Command Line

You can use Popeye standalone or using a spinach yaml config to tune the sanitizer. Details about the Popeye configuration file are below.

# Dump version info
popeye version
# Popeye a cluster using your current kubeconfig environment.
popeye
# Popeye uses a spinach config file of course! aka spinachyaml!
popeye -f spinach.yml
# Popeye a cluster using a kubeconfig context.
popeye --context olive
# Stuck?
popeye help

Output Formats

Popeye can generate sanitizer reports in a variety of formats. You can use the -o cli option and pick your poison from there.

Format Description Default Credits
standard The full monty output iconized and colorized yes
jurassic No icons or color like it's 1979
yaml As YAML
html As HTML
json As JSON
junit For the Java melancholic
prometheus Dumps report a prometheus scrappable metrics dardanel
score Returns a single cluster sanitizer score value (0-100) kabute

The SpinachYAML Configuration

A spinach.yml configuration file can be specified via the -f option to further configure the sanitizers. This file may specify the container utilization threshold and specific sanitizer configurations as well as resources that will be excluded from the sanitization.

NOTE: This file will change as Popeye matures!

Under the excludes key you can configure to skip certain resources, or certain checks by code. Here, resource types are indicated in a group/version/resource notation. Example: to exclude PodDisruptionBugdets, use the notation policy/v1/poddisruptionbudgets. Note that the resource name is written in the plural form and everything is spelled in lowercase. For resources without an API group, the group part is omitted (Examples: v1/pods, v1/services, v1/configmaps).

A resource is identified by a resource kind and a fully qualified resource name, i.e. namespace/resource_name.

For example, the FQN of a pod named fred-1234 in the namespace blee will be blee/fred-1234. This provides for differentiating fred/p1 and blee/p1. For cluster wide resources, the FQN is equivalent to the name. Exclude rules can have either a straight string match or a regular expression. In the latter case the regular expression must be indicated using the rx: prefix.

NOTE! Please be careful with your regex as more resources than expected may get excluded from the report with a loose regex rule. When your cluster resources change, this could lead to a sub-optimal sanitization. Once in a while it might be a good idea to run Popeye β€žconfiglessβ€œ to make sure you will recognize any new issues that may have arisen in your clusters…

Here is an example spinach file as it stands in this release. There is a fuller eks and aks based spinach file in this repo under spinach. (BTW: for new comers into the project, might be a great way to contribute by adding cluster specific spinach file PRs...)

# A Popeye sample configuration file
popeye:
  # Checks resources against reported metrics usage.
  # If over/under these thresholds a sanitization warning will be issued.
  # Your cluster must run a metrics-server for these to take place!
  allocations:
    cpu:
      underPercUtilization: 200 # Checks if cpu is under allocated by more than 200% at current load.
      overPercUtilization: 50   # Checks if cpu is over allocated by more than 50% at current load.
    memory:
      underPercUtilization: 200 # Checks if mem is under allocated by more than 200% at current load.
      overPercUtilization: 50   # Checks if mem is over allocated by more than 50% usage at current load.

  # Excludes excludes certain resources from Popeye scans
  excludes:
    v1/pods:
    # In the monitoring namespace excludes all probes check on pod's containers.
    - name: rx:monitoring
      codes:
      - 102
    # Excludes all istio-proxy container scans for pods in the icx namespace.
    - name: rx:icx/.*
      containers:
        # Excludes istio init/sidecar container from scan!
        - istio-proxy
        - istio-init
    # ConfigMap sanitizer exclusions...
    v1/configmaps:
      # Excludes key must match the singular form of the resource.
      # For instance this rule will exclude all configmaps named fred.v2.3 and fred.v2.4
      - name: rx:fred.+\.v\d+
    # Namespace sanitizer exclusions...
    v1/namespaces:
      # Exclude all fred* namespaces if the namespaces are not found (404), other error codes will be reported!
      - name: rx:kube
        codes:
          - 404
      # Exclude all istio* namespaces from being scanned.
      - name: rx:istio
    # Completely exclude horizontal pod autoscalers.
    autoscaling/v1/horizontalpodautoscalers:
      - name: rx:.*

  # Configure node resources.
  node:
    # Limits set a cpu/mem threshold in % ie if cpu|mem > limit a lint warning is triggered.
    limits:
      # CPU checks if current CPU utilization on a node is greater than 90%.
      cpu:    90
      # Memory checks if current Memory utilization on a node is greater than 80%.
      memory: 80

  # Configure pod resources
  pod:
    # Restarts check the restarts count and triggers a lint warning if above threshold.
    restarts:
      3
    # Check container resource utilization in percent.
    # Issues a lint warning if about these threshold.
    limits:
      cpu:    80
      memory: 75

Popeye In Your Clusters!

Alternatively, Popeye is containerized and can be run directly in your Kubernetes clusters as a one-off or CronJob.

Here is a sample setup, please modify per your needs/wants. The manifests for this are in the k8s directory in this repo.

kubectl apply -f k8s/popeye/ns.yml && kubectl apply -f k8s/popeye
---
apiVersion: batch/v1
kind: CronJob
metadata:
  name:      popeye
  namespace: popeye
spec:
  schedule: "* */1 * * *" # Fire off Popeye once an hour
  concurrencyPolicy: Forbid
  jobTemplate:
    spec:
      template:
        spec:
          serviceAccountName: popeye
          restartPolicy: Never
          containers:
            - name: popeye
              image: quay.io/derailed/popeye
              imagePullPolicy: IfNotPresent
              args:
                - -o
                - yaml
                - --force-exit-zero
                - true
              resources:
                limits:
                  cpu:    500m
                  memory: 100Mi

The --force-exit-zero should be set to true. Otherwise, the pods will end up in an error state. Note that popeye exits with a non-zero error code if the report has any errors.

Popeye got your RBAC!

In order for Popeye to do his work, the signed-in user must have enough RBAC oomph to get/list the resources mentioned above.

Sample Popeye RBAC Rules (please note that those are subject to change.)

---
# Popeye ServiceAccount.
apiVersion: v1
kind:       ServiceAccount
metadata:
  name:      popeye
  namespace: popeye

---
# Popeye needs get/list access on the following Kubernetes resources.
apiVersion: rbac.authorization.k8s.io/v1
kind:       ClusterRole
metadata:
  name: popeye
rules:
- apiGroups: [""]
  resources:
   - configmaps
   - deployments
   - endpoints
   - horizontalpodautoscalers
   - namespaces
   - nodes
   - persistentvolumes
   - persistentvolumeclaims
   - pods
   - secrets
   - serviceaccounts
   - services
   - statefulsets
  verbs:     ["get", "list"]
- apiGroups: ["rbac.authorization.k8s.io"]
  resources:
  - clusterroles
  - clusterrolebindings
  - roles
  - rolebindings
  verbs:     ["get", "list"]
- apiGroups: ["metrics.k8s.io"]
  resources:
  - pods
  - nodes
  verbs:     ["get", "list"]

---
# Binds Popeye to this ClusterRole.
apiVersion: rbac.authorization.k8s.io/v1
kind:       ClusterRoleBinding
metadata:
  name: popeye
subjects:
- kind:     ServiceAccount
  name:     popeye
  namespace: popeye
roleRef:
  kind:     ClusterRole
  name:     popeye
  apiGroup: rbac.authorization.k8s.io

Screenshots

Cluster D Score

Cluster A Score

Report Morphology

The sanitizer report outputs each resource group scanned and their potential issues. The report is color/emoji coded in term of Sanitizer severity levels:

Level Icon Jurassic Color Description
Ok βœ… OK Green Happy!
Info πŸ”Š I BlueGreen FYI
Warn 😱 W Yellow Potential Issue
Error πŸ’₯ E Red Action required

The heading section for each scanned Kubernetes resource provides a summary count for each of the categories above.

The Summary section provides a Popeye Score based on the sanitization pass on the given cluster.

Known Issues

This initial drop is brittle. Popeye will most likely blow up when…

  • You're running older versions of Kubernetes. Popeye works best with Kubernetes 1.13+.
  • You don't have enough RBAC oomph to manage your cluster (see RBAC section)

Disclaimer

This is work in progress! If there is enough interest in the Kubernetes community, we will enhance per your recommendations/contributions. Also if you dig this effort, please let us know that too!

ATTA Girls/Boys!

Popeye sits on top of many of open source projects and libraries. Our sincere appreciations to all the OSS contributors that work nights and weekends to make this project a reality!

Contact Info

  1. Email: [email protected]
  2. Twitter: @kitesurfer

 Β© 2020 Imhotep Software LLC. All materials licensed under Apache v2.0

Comments
  • pushgateway support

    pushgateway support

    Hi , we are running popeye as cronjob on Kubernetes , and added pushgateway support in so basically it converts popeye sanitizer to prometheus metrics as below

    popeye_errors{instance="",job="popeye"} 1
    # HELP popeye_grade Grade of kubernetes cluster. (1: A, 2: B, 3: C, 4: D, 5: E, 6: F)
    # TYPE popeye_grade gauge
    popeye_grade{instance="",job="popeye"} 5
    # HELP popeye_sanitizers_error Sanitizer error level results for resource groups.
    # TYPE popeye_sanitizers_error gauge
    popeye_sanitizers_error{instance="",job="popeye",title="configmap"} 0
    popeye_sanitizers_error{instance="",job="popeye",title="daemonset"} 0
    popeye_sanitizers_error{instance="",job="popeye",title="deployment"} 1
    popeye_sanitizers_error{instance="",job="popeye",title="horizontalpodautoscaler"} 0
    popeye_sanitizers_error{instance="",job="popeye",title="ing"} 0
    popeye_sanitizers_error{instance="",job="popeye",title="namespace"} 0
    popeye_sanitizers_error{instance="",job="popeye",title="networkpolicy"} 0
    popeye_sanitizers_error{instance="",job="popeye",title="node"} 0
    popeye_sanitizers_error{instance="",job="popeye",title="persistentvolume"} 0
    popeye_sanitizers_error{instance="",job="popeye",title="persistentvolumeclaim"} 0
    popeye_sanitizers_error{instance="",job="popeye",title="pod"} 6
    popeye_sanitizers_error{instance="",job="popeye",title="poddisruptionbudget"} 1
    popeye_sanitizers_error{instance="",job="popeye",title="podsecuritypolicy"} 0
    popeye_sanitizers_error{instance="",job="popeye",title="replicaset"} 0
    popeye_sanitizers_error{instance="",job="popeye",title="secret"} 0
    popeye_sanitizers_error{instance="",job="popeye",title="service"} 1
    popeye_sanitizers_error{instance="",job="popeye",title="serviceaccount"} 0
    popeye_sanitizers_error{instance="",job="popeye",title="statefulset"} 0
    # HELP popeye_sanitizers_info Sanitizer info level results for resource groups.
    # TYPE popeye_sanitizers_info gauge
    popeye_sanitizers_info{instance="",job="popeye",title="configmap"} 83
    popeye_sanitizers_info{instance="",job="popeye",title="daemonset"} 0
    popeye_sanitizers_info{instance="",job="popeye",title="deployment"} 1
    popeye_sanitizers_info{instance="",job="popeye",title="horizontalpodautoscaler"} 0
    popeye_sanitizers_info{instance="",job="popeye",title="ing"} 0
    popeye_sanitizers_info{instance="",job="popeye",title="namespace"} 3
    popeye_sanitizers_info{instance="",job="popeye",title="networkpolicy"} 0
    popeye_sanitizers_info{instance="",job="popeye",title="node"} 0
    popeye_sanitizers_info{instance="",job="popeye",title="persistentvolume"} 0
    popeye_sanitizers_info{instance="",job="popeye",title="persistentvolumeclaim"} 0
    popeye_sanitizers_info{instance="",job="popeye",title="pod"} 0
    popeye_sanitizers_info{instance="",job="popeye",title="poddisruptionbudget"} 0
    popeye_sanitizers_info{instance="",job="popeye",title="podsecuritypolicy"} 0
    popeye_sanitizers_info{instance="",job="popeye",title="replicaset"} 0
    popeye_sanitizers_info{instance="",job="popeye",title="secret"} 36
    popeye_sanitizers_info{instance="",job="popeye",title="service"} 25
    popeye_sanitizers_info{instance="",job="popeye",title="serviceaccount"} 4
    popeye_sanitizers_info{instance="",job="popeye",title="statefulset"} 0
    # HELP popeye_sanitizers_ok Sanitizer ok level results for resource groups.
    # TYPE popeye_sanitizers_ok gauge
    popeye_sanitizers_ok{instance="",job="popeye",title="configmap"} 16
    popeye_sanitizers_ok{instance="",job="popeye",title="daemonset"} 5
    popeye_sanitizers_ok{instance="",job="popeye",title="deployment"} 4
    popeye_sanitizers_ok{instance="",job="popeye",title="horizontalpodautoscaler"} 0
    popeye_sanitizers_ok{instance="",job="popeye",title="ing"} 0
    popeye_sanitizers_ok{instance="",job="popeye",title="namespace"} 2
    popeye_sanitizers_ok{instance="",job="popeye",title="networkpolicy"} 0
    popeye_sanitizers_ok{instance="",job="popeye",title="node"} 8
    popeye_sanitizers_ok{instance="",job="popeye",title="persistentvolume"} 0
    popeye_sanitizers_ok{instance="",job="popeye",title="persistentvolumeclaim"} 0
    popeye_sanitizers_ok{instance="",job="popeye",title="pod"} 0
    popeye_sanitizers_ok{instance="",job="popeye",title="poddisruptionbudget"} 0
    popeye_sanitizers_ok{instance="",job="popeye",title="podsecuritypolicy"} 0
    popeye_sanitizers_ok{instance="",job="popeye",title="replicaset"} 68
    popeye_sanitizers_ok{instance="",job="popeye",title="secret"} 41
    popeye_sanitizers_ok{instance="",job="popeye",title="service"} 5
    popeye_sanitizers_ok{instance="",job="popeye",title="serviceaccount"} 52
    popeye_sanitizers_ok{instance="",job="popeye",title="statefulset"} 1
    # HELP popeye_sanitizers_score Sanitizer score results for resource groups.
    # TYPE popeye_sanitizers_score gauge
    popeye_sanitizers_score{instance="",job="popeye",title="configmap"} 100
    popeye_sanitizers_score{instance="",job="popeye",title="daemonset"} 50
    popeye_sanitizers_score{instance="",job="popeye",title="deployment"} 19
    popeye_sanitizers_score{instance="",job="popeye",title="horizontalpodautoscaler"} 0
    popeye_sanitizers_score{instance="",job="popeye",title="ing"} 0
    popeye_sanitizers_score{instance="",job="popeye",title="namespace"} 100
    popeye_sanitizers_score{instance="",job="popeye",title="networkpolicy"} 0
    popeye_sanitizers_score{instance="",job="popeye",title="node"} 100
    popeye_sanitizers_score{instance="",job="popeye",title="persistentvolume"} 0
    popeye_sanitizers_score{instance="",job="popeye",title="persistentvolumeclaim"} 0
    popeye_sanitizers_score{instance="",job="popeye",title="pod"} 0
    popeye_sanitizers_score{instance="",job="popeye",title="poddisruptionbudget"} 0
    popeye_sanitizers_score{instance="",job="popeye",title="podsecuritypolicy"} 0
    popeye_sanitizers_score{instance="",job="popeye",title="replicaset"} 100
    popeye_sanitizers_score{instance="",job="popeye",title="secret"} 100
    popeye_sanitizers_score{instance="",job="popeye",title="service"} 96
    popeye_sanitizers_score{instance="",job="popeye",title="serviceaccount"} 100
    popeye_sanitizers_score{instance="",job="popeye",title="statefulset"} 50
    # HELP popeye_sanitizers_warning Sanitizer warning level results for resource groups.
    # TYPE popeye_sanitizers_warning gauge
    popeye_sanitizers_warning{instance="",job="popeye",title="configmap"} 0
    popeye_sanitizers_warning{instance="",job="popeye",title="daemonset"} 5
    popeye_sanitizers_warning{instance="",job="popeye",title="deployment"} 20
    popeye_sanitizers_warning{instance="",job="popeye",title="horizontalpodautoscaler"} 2
    popeye_sanitizers_warning{instance="",job="popeye",title="ing"} 12
    popeye_sanitizers_warning{instance="",job="popeye",title="namespace"} 0
    popeye_sanitizers_warning{instance="",job="popeye",title="networkpolicy"} 0
    popeye_sanitizers_warning{instance="",job="popeye",title="node"} 0
    popeye_sanitizers_warning{instance="",job="popeye",title="persistentvolume"} 0
    popeye_sanitizers_warning{instance="",job="popeye",title="persistentvolumeclaim"} 0
    popeye_sanitizers_warning{instance="",job="popeye",title="pod"} 114
    popeye_sanitizers_warning{instance="",job="popeye",title="poddisruptionbudget"} 0
    popeye_sanitizers_warning{instance="",job="popeye",title="podsecuritypolicy"} 0
    popeye_sanitizers_warning{instance="",job="popeye",title="replicaset"} 0
    popeye_sanitizers_warning{instance="",job="popeye",title="secret"} 0
    popeye_sanitizers_warning{instance="",job="popeye",title="service"} 0
    popeye_sanitizers_warning{instance="",job="popeye",title="serviceaccount"} 0
    popeye_sanitizers_warning{instance="",job="popeye",title="statefulset"} 1
    # HELP popeye_score Score of kubernetes cluster.
    # TYPE popeye_score gauge
    popeye_score{instance="",job="popeye"} 58
    

    Run command is like below

    popeye --out prometheus --pushgateway-address http://pushgateway.address

    opened by eminugurkenar 18
  • v0.3.0 crashes at start: runtime error: invalid memory address or nil pointer dereference

    v0.3.0 crashes at start: runtime error: invalid memory address or nil pointer dereference




    Describe the bug Running popeye by just typing "popeye" on the shell leads to the following error: runtime error: invalid memory address or nil pointer dereference.

    The logfile is empty.

    To Reproduce Steps to reproduce the behavior:

    1. Open shell
    2. type popeye
    3. press enter
    4. See error

    Expected behavior See popeye work as desired

    Screenshots image

    image

    Versions (please complete the following information):

    • OS: macOS
    • Popeye 0.3.0
    • K8s 1.13.5 and 1.12.6

    Additional context ... my sincere condolences! ...

    Log

    8:01AM ERR runtime error: invalid memory address or nil pointer dereference
    8:01AM ERR goroutine 1 [running]:
    runtime/debug.Stack(0x2e9aae0, 0x20caa03, 0x0)
    	/usr/local/Cellar/go/1.12.3/libexec/src/runtime/debug/stack.go:24 +0x9d
    github.com/derailed/popeye/cmd.doIt.func1()
    	/Users/fernand/go_wk/derailed/src/github.com/derailed/popeye/cmd/root.go:50 +0x15b
    panic(0x1f3e620, 0x2e83250)
    	/usr/local/Cellar/go/1.12.3/libexec/src/runtime/panic.go:522 +0x1b5
    github.com/derailed/popeye/internal/linter.(*Secret).checkContainerRefs(0xc00043a0b0, 0xc0001270e0, 0x25, 0xc000566140, 0x1, 0x1, 0xc000616ea0)
    	/Users/fernand/go_wk/derailed/src/github.com/derailed/popeye/internal/linter/secret.go:178 +0x26a
    github.com/derailed/popeye/internal/linter.(*Secret).lint(0xc00043a0b0, 0xc0004b6ba0, 0xc00039f410, 0xc0003dc480)
    	/Users/fernand/go_wk/derailed/src/github.com/derailed/popeye/internal/linter/secret.go:85 +0x2ce
    github.com/derailed/popeye/internal/linter.(*Secret).Lint(0xc00043a0b0, 0x22e15e0, 0xc0000f8540, 0x20cb19c, 0x3)
    	/Users/fernand/go_wk/derailed/src/github.com/derailed/popeye/internal/linter/secret.go:51 +0xec
    github.com/derailed/popeye/pkg.(*Popeye).sanitize(0xc0000f8500)
    	/Users/fernand/go_wk/derailed/src/github.com/derailed/popeye/pkg/popeye.go:140 +0x1ef
    github.com/derailed/popeye/pkg.(*Popeye).Sanitize(0xc0000f8500)
    	/Users/fernand/go_wk/derailed/src/github.com/derailed/popeye/pkg/popeye.go:106 +0x2b
    github.com/derailed/popeye/cmd.doIt(0x2e8d460, 0x2eb87c0, 0x0, 0x0)
    	/Users/fernand/go_wk/derailed/src/github.com/derailed/popeye/cmd/root.go:60 +0x11b
    github.com/spf13/cobra.(*Command).execute(0x2e8d460, 0xc00003a1b0, 0x0, 0x0, 0x2e8d460, 0xc00003a1b0)
    	/Users/fernand/go_wk/derailed/pkg/mod/github.com/spf13/[email protected]/command.go:766 +0x2ae
    github.com/spf13/cobra.(*Command).ExecuteC(0x2e8d460, 0x0, 0x0, 0xc0003d9f88)
    	/Users/fernand/go_wk/derailed/pkg/mod/github.com/spf13/[email protected]/command.go:852 +0x2ec
    github.com/spf13/cobra.(*Command).Execute(...)
    	/Users/fernand/go_wk/derailed/pkg/mod/github.com/spf13/[email protected]/command.go:800
    github.com/derailed/popeye/cmd.Execute()
    	/Users/fernand/go_wk/derailed/src/github.com/derailed/popeye/cmd/root.go:37 +0x32
    main.main()
    	/Users/fernand/go_wk/derailed/src/github.com/derailed/popeye/main.go:25 +0x20
    
    bug 
    opened by ghost 16
  • can't run popeye when kubernetes has networking.k8s.io/v1/ingresses

    can't run popeye when kubernetes has networking.k8s.io/v1/ingresses




    Describe the bug When i download the released binary file, and run "./popeye", it shows "Boom! No resource meta found for networking.k8s.io/v1/ingresses". Can I skip the resource?

    To Reproduce just run "./popeye"

    Expected behavior popeye can run as normal

    Screenshots If applicable, add screenshots to help explain your problem.

    Versions (please complete the following information): image

    Additional context Add any other context about the problem here.

    bug 
    opened by woodliu 12
  • Add S3 support

    Add S3 support

    This PR will add support to upload reports directly to AWS S3.

    Current state, already working πŸŽ‰

    ~There is still documentation & some refactoring missing.~

    Use case: Our current workflow is currently to run Popeye on a regular base via a CronJob (once a week) and afterwards post the report to AWS, this will be easier when it's possible to persist the report to S3.

    opened by guusvw 11
  • Allow suppressing specific checks / reports for specific instances

    Allow suppressing specific checks / reports for specific instances




    Is your feature request related to a problem? Please describe. Some sanitizers are producing warnings which make sense most of time, but on some objects, I would like to be able to accept those "issues". For example, the "container runs as root" is very helpful 98% of the times, but some very infrastructure-related pods require this.

    Describe the solution you'd like It would be nice if there was a way to skip specific aspects of a sanitizer by given names or regex for objects on which they should not be run, or at least on which they should not be reported (and maybe even not considered for the overall score)

    Describe alternatives you've considered Just excluding the objects (e.g. pods) is not enough, since this will ignore all checks on them.

    Additional context No additional context.

    enhancement question 
    opened by djablonski-moia 9
  • Port name missing considered an error

    Port name missing considered an error

    Hi, just a brainstorming here.

    Why do you consider an unnamed port in a deployment/pod as an error? Do you have a source on the documentation that supports this decision?

    Thanks

    enhancement question 
    opened by whites11 9
  • Add check for Service with a single endpoint

    Add check for Service with a single endpoint




    Is your feature request related to a problem? Please describe. No. The feature request is about adding a check for something that is currently not covered.

    Describe the solution you'd like

    Services backed by only a single endpoint can fail once the endpoitn goes down, e. g. due to a failure of the node running the endpoint pod. Services should ideally be backed by more than one endpoint for high availability.

    popeye should inform/warn about services with only a single endpoint.

    Describe alternatives you've considered None

    Additional context

    PR: https://github.com/derailed/popeye/pull/135

    opened by marians 8
  • v1 Ingress in K8s v1.22 not found

    v1 Ingress in K8s v1.22 not found




    Describe the bug

    INGRESSES (1 SCANNED)                                                          πŸ’₯ 1 😱 0 πŸ”Š 0 βœ… 0 0Ωͺ
    β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…β”…
        πŸ’₯ the server could not find the requested resource.
    

    To Reproduce Steps to reproduce the behavior:

    1. Use Docker Desktop (or presumably another Kubernetes v1.22.5 environment)
    2. Install a v1 Ingress
    3. Run popeye

    Expected behavior Ingress resources should be fine. They were ok with popeye 0.9.0 (except it warned that the v1 API was deprecated).

    Screenshots If applicable, add screenshots to help explain your problem.

    Versions (please complete the following information):

    • OS: macOS
    • Popeye 0.9.8
    • K8s v1.22.5
    bug 
    opened by MikaelSmith 7
  • Add extra labels to prometheus report (warn and error level only)

    Add extra labels to prometheus report (warn and error level only)

    Basic details about issues for prometheus report. Afaik it can be largely improved.

    Capabilities:

    • Expose detail messages for the outcome issues
    • Fine tune the output via lint level flag

    Atm the final result on the Prometheus POV would be (example for service): $popeye -o prometheus --pushgateway-address http://localhost:9091 -l error -n testns --out-detail verbose

    popeye_sanitizer_reports_count{cluster="testcluster",issues="testns/kafka [POP-1100] No pods match service selector,testns/kafka [POP-1105] No associated endpoints",job="popeye",level="error",namespace="testns/kafka",resource="service"} | 1

    opened by sky-philipalmeida 7
  • add a flag for switching non-zero exit status off

    add a flag for switching non-zero exit status off

    In version 0.8.9, popeye was changed to return a non-zero exit status if the report has any errors. While this is helpful for stopping CI/CD pipelines, it broke the functionality of running popeye as a CronJob. When run as a CronJob and the report has errors, the pod results in an error state and lingers around.

    This pull request makes the non-zero exit status as an optional feature. I have added a new flag --error-status-on-fail. It defaults to true. When set to false, popeye always returns a zero exit status.

    More on the issue discussed here: https://github.com/derailed/popeye/issues/122

    opened by premkumar-gg 6
  • ADD Support to return just the score value as output

    ADD Support to return just the score value as output

    Add support to just return the score value. This change is introduced to simplify the usage of Popeye for general instrumentation (e.g. automated testing/metrics).

    opened by kabute 6
  • πŸ“¦ Add arm64 Darwin releases to krew-index

    πŸ“¦ Add arm64 Darwin releases to krew-index

    These changes update the .krew.yaml file used to publish new versions of popeye to the krew-index to include artifacts for arm64 machines running macOS (Darwin). As a result of these changes, developers using Apple Silicon devices will be able to install popeye using brew.

    Fixes #221

    opened by connorbrinton 0
  • Support multiple outputs at once

    Support multiple outputs at once




    Is your feature request related to a problem? Please describe. It seems wasteful to run Popeye several times targeting the same namespace if I want to produce both an html report and push metrics to a Prometheus pushgateway.

    Describe the solution you'd like Allow specifying multiple outputs.

    Describe alternatives you've considered Running Popeye multiple times targeting the same namespace but with a different output format each time.

    opened by rbjorklin 0
  • Checking Kubernetes 1.25 clusters fails due to PodSecurityPolicy

    Checking Kubernetes 1.25 clusters fails due to PodSecurityPolicy




    Describe the bug

    When checking a cluster that is running Kubernetes 1.25, popeye fails with the following error message:

    Boom! No resource meta found for policy/v1beta1/podsecuritypolicies
    

    This is obviously due to the fact that PSPs have been removed from K8s 1.25.

    To Reproduce

    Just run popeye without any params against a 1.25 cluster

    Expected behavior

    Results being displayed

    Screenshots

    none

    Versions (please complete the following information):

    • OS: OSX 12.6.1
    • Popeye 0.10.1
    • K8s 1.25.4

    Additional context Add any other context about the problem here.

    opened by djablonski-moia 1
  • --lint level does not affect html output

    --lint level does not affect html output




    Describe the bug --lint does not affect the HTML output

    To Reproduce Steps to reproduce the behavior:

    1. popeye -l error -o html

    Expected behavior Only error messages are showed in the output

    Versions (please complete the following information):

    • OS: PopOS
    • Popeye 0.10.1
    • K8s v1.21.14-gke.3000
    opened by AndersBennedsgaard 0
  • migrate to aws-sdk-go-v2

    migrate to aws-sdk-go-v2

    A padding oracle vulnerability exists in the AWS S3 Crypto SDK for GoLang versions prior to V2.

    CVE-2020-8911


    I don't use the s3 feature so that'll need some testing but the go tests pass

    opened by 06kellyjac 0
Releases(v0.10.1)
Owner
Fernand Galiana
Owner of Imhotep Software a consultancy specializing in architecture, software development and corporate training for GO and Kubernetes
Fernand Galiana
Fadvisor(FinOps Advisor) is a collection of exporters which collect cloud resource pricing and billing data guided by FinOps, insight cost allocation for containers and kubernetes resource

[TOC] Fadvisor: FinOps Advisor fadvisor(finops advisor) is used to solve the FinOps Observalibility, it can be integrated with Crane to help users to

Crane 41 Jan 3, 2023
Terraform Provider for Azure (Resource Manager)Terraform Provider for Azure (Resource Manager)

Terraform Provider for Azure (Resource Manager) Version 2.x of the AzureRM Provider requires Terraform 0.12.x and later, but 1.0 is recommended. Terra

null 0 Oct 16, 2021
Apachedist-resource - A concourse resource to track updates of an apache distribution, e.g. tomcat

Apache Distribution Resource A concourse resource that can track information abo

Gareth Evans 0 Feb 2, 2022
kubetnl tunnels TCP connections from within a Kubernetes cluster to a cluster-external endpoint, e.g. to your local machine. (the perfect complement to kubectl port-forward)

kubetnl kubetnl (kube tunnel) is a command line utility to tunnel TCP connections from within a Kubernetes to a cluster-external endpoint, e.g. to you

null 5 Dec 16, 2022
A Terraform module to manage cluster authentication (aws-auth) for an Elastic Kubernetes (EKS) cluster on AWS.

Archive Notice The terraform-aws-modules/eks/aws v.18.20.0 release has brought back support aws-auth configmap! For this reason, I highly encourage us

Aidan Melen 28 Dec 4, 2022
vcluster - Create fully functional virtual Kubernetes clusters - Each cluster runs inside a Kubernetes namespace and can be started within seconds

Website β€’ Quickstart β€’ Documentation β€’ Blog β€’ Twitter β€’ Slack vcluster - Virtual Clusters For Kubernetes Lightweight & Low-Overhead - Based on k3s, bu

Loft Labs 2.3k Jan 4, 2023
PolarDB-X Operator is a Kubernetes extension that aims to create and manage PolarDB-X cluster on Kubernetes.

GalaxyKube -- PolarDB-X Operator PolarDB-X Operator is a Kubernetes extension that aims to create and manage PolarDB-X cluster on Kubernetes. It follo

null 64 Dec 19, 2022
kitex running in kubernetes cluster and discover each other in kubernetes Service way

Using kitex in kubernetes Kitex [kaΙͺt'eks] is a high-performance and strong-extensibility Golang RPC framework. This go module helps you to build mult

adolli 1 Feb 21, 2022
A pod scaler golang app that can scale replicas either inside of cluster or out of the cluster

pod-scaler A simple pod scaler golang application that can scale replicas via manipulating the deployment Technologies The project has been created us

Mert Doğan 0 Oct 24, 2021
Go-gke-pulumi - A simple example that deploys a GKE cluster and an application to the cluster using pulumi

This example deploys a Google Cloud Platform (GCP) Google Kubernetes Engine (GKE) cluster and an application to it

Snigdha Sambit Aryakumar 1 Jan 25, 2022
Influxdb-cluster - InfluxDB Cluster for replacing InfluxDB Enterprise

InfluxDB ATTENTION: Around January 11th, 2019, master on this repository will be

Shiwen Cheng 524 Dec 26, 2022
Helm Operator is designed to managed the full lifecycle of Helm charts with Kubernetes CRD resource.

Helm Operator Helm Operator is designed to install and manage Helm charts with Kubernetes CRD resource. Helm Operator does not create the Helm release

Chen Zhiwei 5 Aug 25, 2022
OpenDILab RL Kubernetes Custom Resource and Operator Lib

DI Orchestrator DI Orchestrator is designed to manage DI (Decision Intelligence) jobs using Kubernetes Custom Resource and Operator. Prerequisites A w

OpenDILab 206 Jan 5, 2023
Crane (FinOps Crane) is an opensource project which manages cloud resource on Kubernetes stack, it is inspired by FinOps concepts.

Crane (FinOps Crane) is an opensource project which manages cloud resource on Kubernetes stack, it is inspired by FinOps concepts. Goal of Crane is to provide an one-stop shop project to help Kubernetes users to save cloud resource usage with a rich set of functionalities.

Crane 1.1k Jan 3, 2023
Kubernetes resource manager.

Halyard Halyard is in an experimentation phase where I will will be learning a lot and changing my opinion (and APIs) very often. Halyard is a deploym

Frank 0 Dec 13, 2021
A Controller written in kubernetes sample-controller style which watches a custom resource named Bookstore

bookstore-sample-controller A Controller written in kubernetes sample-controller style which watches a custom resource named Bookstore. A resource cre

Abdullah Al Shaad 0 Jan 20, 2022
kubernetes Display Resource (CPU/Memory/Gpu/PodCount) Usage and Request and Limit.

kubectl resource-view A plugin to access Kubernetes resource requests, limits, and usage. Display Resource (CPU/Memory/Gpu/PodCount) Usage and Request

bryant-rh 8 Apr 22, 2022
Kubernetes OS Server - Kubernetes Extension API server exposing OS configuration like sysctl via Kubernetes API

KOSS is a Extension API Server which exposes OS properties and functionality using Kubernetes API, so it can be accessed using e.g. kubectl. At the moment this is highly experimental and only managing sysctl is supported. To make things actually usable, you must run KOSS binary as root on the machine you will be managing.

Mateusz Gozdek 3 May 19, 2021
Multi cluster kubernetes dashboard with batteries included. Build by developers, for developers.

kubetower Multi cluster kubernetes dashboard with batteries included. Built by developers, for developers. Features Restart deployments with one click

Emre SavcΔ± 33 Nov 28, 2022