kubeeye

module
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2024 License: Apache-2.0

README

English | 中文

KubeEye is a cloud-native cluster inspection tool specifically designed for Kubernetes, capable of identifying issues and risks within the Kubernetes cluster based on custom rules.

QuickStart

Installation

Download the installation package from Releases, which includes Helm chart, demo rules, and images for offline installation.

VERSION=v1.0.3

wget https://github.com/kubesphere/kubeeye/releases/download/${VERSION}/kubeeye-offline-${VERSION}.tar.gz

tar -zxvf kubeeye-offline-${VERSION}.tar.gz

cd kubeeye-offline-${VERSION}

# offline installation, please import the images in the 'images' folder into the local container repository yourself and modify the images repo in `chart/kubeeye/values.yaml`.

helm upgrade --install kubeeye chart/kubeeye -n kubeeye-system --create-namespace

Usage

Import Inspect Rules

The rules directory in the installation package provides demo rules, which can be customized according to specific needs.

Notice: PromQL rules need to have the endpoint of Prometheus set in advance.

kubectl apply -f rules
Create Inspect Plan

Configure inspection plans on demand.

cat > plan.yaml << EOF
apiVersion: kubeeye.kubesphere.io/v1alpha2
kind: InspectPlan
metadata:
  name: inspectplan
spec:
  # The planned time for executing inspections only supports cron expressions. For example, '*/30 * * * ?' means that the inspection will be performed every 30 minutes.'
  # If only a single inspection is required, then remove this parameter.
  schedule: "* */12 * * ?"
  # The maximum number of retained inspection results, if not filled in, will retain all.
  maxTasks: 10 
  # Should the inspection plan be paused, applicable only to periodic inspections, true or false (default is false).
  suspend: false
  # Inspection timeout, default 10 minutes.
  timeout: 10m
  # Inspection rule list, used to associate corresponding inspection rules, please fill in the inspectRule name.
  # Execute `kubectl get inspectrule` to view the inspection rules in the cluster.
  ruleNames:
  - name: configmap-inspect-rules
  - name: cronjob-inspect-rules
  - name: daemonset-inspect-rules
  - name: deployment-inspect-rules
  - name: event-inspect-rules
  - name: job-inspect-rules
  - name: node-inspect-rules
  - name: pod-inspect-rules
  - name: pod-state-inspect-rules
  # nodeName: master
  # nodeSelector:
  #   node-role.kubernetes.io/master: ""        
  # Multi-cluster inspection (currently only supports multi-cluster inspection in KubeSphere)
  # clusterName: 
  # - name: host
EOF


kubectl apply -f plan.yaml
Obtaining Inspection Reports
Check Inspection Results
# View the name of the inspection result for inspection report download.
kubectl get inspectresult
Command
## Get the address and port of kubeeye-apiserver service.
kubectl get svc -n kubeeye-system kubeeye-apiserver -o custom-columns=CLUSTER-IP:.spec.clusterIP,PORT:.spec.ports[*].port

## Download the inspection report, and please replace <> with the actual information obtained from the environment.
curl http://<svc-ip>:9090/kapis/kubeeye.kubesphere.io/v1alpha2/inspectresults/<result name>\?type\=html -o inspectReport.html

## After downloading, you can use a browser to open the HTML file for viewing.
Web Console
## Create a nodePort type svc for kubeeye-apiserver.
kubectl -n kubeeye-system expose deploy kubeeye-apiserver --port=9090 --type=NodePort --name=ke-apiserver-node-port

## Enter the inspection report URL in the browser to view, and remember to replace <> with the actual information obtained from the environment.
http://<node address>:<node port>/kapis/kubeeye.kubesphere.io/v1alpha2/inspectresults/<result name>?type=html

Supported Rules List

  • OPA
  • PromQL
  • File Change
  • Kernel Parameter Configuration
  • Systemd Service Status
  • Node Basic Info
  • File Content Inspection
  • Service Connectivity

Directories

Path Synopsis
apis
kubeeye/v1alpha2
Package v1alpha2 contains API Schema definitions for the kubeeye v1alpha2 API group +kubebuilder:object:generate=true +groupName=kubeeye.kubesphere.io
Package v1alpha2 contains API Schema definitions for the kubeeye v1alpha2 API group +kubebuilder:object:generate=true +groupName=kubeeye.kubesphere.io
clients
clientset/versioned
This package has the automatically generated clientset.
This package has the automatically generated clientset.
clientset/versioned/fake
This package has the automatically generated fake clientset.
This package has the automatically generated fake clientset.
clientset/versioned/scheme
This package contains the scheme of the automatically generated clientset.
This package contains the scheme of the automatically generated clientset.
clientset/versioned/typed/kubeeye/v1alpha2
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
clientset/versioned/typed/kubeeye/v1alpha2/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
cmd
ke
examples
pkg
plugins
kubebench Module
kubehunter Module
Package swaggerDocs Code generated by swaggo/swag.
Package swaggerDocs Code generated by swaggo/swag.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL