You must be registered for see links
You must be registered for see links
You must be registered for see links
KubeEye is an inspection tool for Kubernetes. It discovers whether Kubernetes resources (by usingEnglish |You must be registered for see links
You must be registered for see links
), cluster components, cluster nodes (by using
You must be registered for see links
), and other configurations comply with best practices and makes modification suggestions accordingly.KubeEye supports custom inspection rules and plugin installation. With
You must be registered for see links
, you can intuitively view the inspection results and modification suggestions on the web console.Architecture
KubeEye obtains cluster resource details by using Kubernetes APIs, inspects resource configurations by using inspection rules and plugins, and generates inspection results. The architecture of KubeEye is as follows:
You must be registered for see links
Install and use KubeEye
- Install KubeEye on your machine.
- Method 1: Download the pre-built executable file from
You must be registered for see links.
- Method 2: Build from the source code.
git cloneNote: KubeEye files will be generated in /usr/local/bin/ on your machine.
You must be registered for see links
cd kubeeye make installke- (Optional) Install
You must be registered for see links.
kubeeye install npdNote: If you need detailed reports, run the following command, and then NPD will be installed on your cluster.
- Run KubeEye to inspect clusters.
kubeeye audit KIND NAMESPACE NAME REASON LEVEL MESSAGE Node docker-desktop kubelet has no sufficient memory available warning KubeletHasNoSufficientMemory Node docker-desktop kubelet has no sufficient PID available warning KubeletHasNoSufficientPID Node docker-desktop kubelet has disk pressure warning KubeletHasDiskPressure Deployment default testkubeeye NoCPULimits Deployment default testkubeeye NoReadinessProbe Deployment default testkubeeye NotRunAsNonRoot Deployment kube-system coredns NoCPULimits Deployment kube-system coredns ImagePullPolicyNotAlways Deployment kube-system coredns NotRunAsNonRoot Deployment kubeeye-system kubeeye-controller-manager ImagePullPolicyNotAlways Deployment kubeeye-system kubeeye-controller-manager NotRunAsNonRoot DaemonSet kube-system kube-proxy NoCPULimits DaemonSet k ube-system kube-proxy NotRunAsNonRoot Event kube-system coredns-558bd4d5db-c26j8.16d5fa3ddf56675f Unhealthy warning Readiness probe failed: Get “Note: The results of KubeEye are sorted by resource kind.
You must be registered for see links
”: dial tcp 10.1.0.87:8181: connect: connection refused Event kube-system coredns-558bd4d5db-c26j8.16d5fa3fbdc834c9 Unhealthy warning Readiness probe failed: HTTP probe failed with statuscode: 503 Event kube-system vpnkit-controller.16d5ac2b2b4fa1eb BackOff warning Back-off restarting failed container Event kube-system vpnkit-controller.16d5fa44d0502641 BackOff warning Back-off restarting failed container Event kubeeye-system kubeeye-controller-manager-7f79c4ccc8-f2njw.16d5fa3f5fc3229c Failed warning Failed to pull image “controller:latest”: rpc error: code = Unknown desc = Error response from daemon: pull access denied for controller, repository does not exist or may require ‘docker login’: denied: requested access to the resource is denied Event kubeeye-system kubeeye-controller-manager-7f79c4ccc8-f2njw.16d5fa3f61b28527 Failed warning Error: ImagePullBackOff Role kubeeye-system kubeeye-leader-election-role CanDeleteResources ClusterRole kubeeye-manager-role CanDeleteResources ClusterRole kubeeye-manager-role CanModifyWorkloads ClusterRole vpnkit-controller CanImpersonateUser ClusterRole vpnkit-controller CanDeleteResourcesHow KubeEye can help you
- It inspects cluster resources according to Kubernetes best practices to ensure that clusters run stably.
- It detects the control plane problems of the cluster, including kube-apiserver, kube-controller-manager, and etcd.
- It detects node problems, including memory, CPU, disk pressure, and unexpected kernel error logs.
Checklist
Add your own inspection rules
Add custom OPA rules
- Create a directory for storing OPA rules.
- Add custom OPA rule files.
Note:
- OPA rule for checking workloads: The package name must be kubeeye_workloads_rego.
- OPA rule for checking RBAC settings: The package name must be kubeeye_RBAC_rego.
- OPA rule for checking node settings: The package name must be kubeeye_nodes_rego.
- To check whether the image registry address complies with rules, save the following rules to imageRegistryRule.rego
- Run KubeEye with custom rules.
root:# kubeeye audit -p ./opa NAMESPACE NAME KIND MESSAGE default nginx1 Deployment [ImageRegistryNotmyregistry NotReadOnlyRootFilesystem NotRunAsNonRoot] default nginx11 Deployment [ImageRegistryNotmyregistry PrivilegeEscalationAllowed HighRiskCapabilities HostIPCAllowed HostPortAllowed ImagePullPolicyNotAlways ImageTagIsLatest InsecureCapabilities NoPriorityClassName PrivilegedAllowed NotReadOnlyRootFilesystem NotRunAsNonRoot] default nginx111 Deployment [ImageRegistryNotmyregistry NoCPULimits NoCPURequests ImageTagMiss NoLivenessProbe NoMemoryLimits NoMemoryRequests NoPriorityClassName NotReadOnlyRootFilesystem NoReadinessProbe NotRunAsNonRoot]Note: Kubeeye will read all files ending with .rego in the directory.
Add custom NPD rules
- Run the following command to change the ConfigMap:
- Run the following command to restart NPD:
KubeEye Operator
What is KubeEye Operator
KubeEye Operator is an inspection platform for Kubernetes. It manages KubeEye to regularly inspect clusters and generate inspection results.How KubeEye Operator can help you
- It records inspection results by using CR and provide a web page for you to intuitively view and compare cluster inspection results.
- It provides more plugins.
- It provides more detailed modification suggestions.
Deploy KubeEye Operator
kubectl apply -f
You must be registered for see links
kubectl apply -f
You must be registered for see links
Obtain the inspection results
kubectl get clusterinsight -o yamlapiVersion: v1
items:
- apiVersion: kubeeye.kubesphere.io/v1alpha1
kind: ClusterInsight
metadata:
name: clusterinsight-sample
namespace: default
spec:
auditPeriod: 24h
status:
auditResults:
auditResults:
- resourcesType: Node
resultInfos:
- namespace: ""
resourceInfos:
- items:
- level: warning
message: KubeletHasNoSufficientMemory
reason: kubelet has no sufficient memory available
- level: warning
message: KubeletHasNoSufficientPID
reason: kubelet has no sufficient PID available
- level: warning
message: KubeletHasDiskPressure
reason: kubelet has disk pressure
name: kubeeyeNode
GitHub:
You must be registered for see images
You must be registered for see links