Skip to content

Repository files navigation

kubestatus-operator

Docker Cloud Build Status

Description

Kubestatus is an free and open-source tool to easily add status page to your Kubernetes cluster that currently display the status (operational, degraded or DOWN) of services.It is written in Go and uses the Kubernetes API to fetch information about the clusters and resources checck the kubestatus-operand image.

The tool provides a simple and convenient way to view the current state of your cluster and resources without having to use the kubectl command-line tool or the Kubernetes dashboard and in the same time give you a costumer friendly page that can be used as you main status page.

Features:

  • ⚡ Lightweight
  • 🔧 Minimal configuration
  • 📖 Open-source
  • 📫 Support TCP and UDP services

Prerequisites

Before installing the KubeStatus Operator, ensure you have:

  • Kubernetes cluster version 1.19+
  • kubectl installed and configured
  • Cluster admin access or appropriate RBAC permissions

Installation

Quick Install

You can install the KubeStatus Operator using the following command:

kubectl apply -f https://raw.githubusercontent.com/soubai/kubestatus-operator/main/dist/install.yaml

Manual Installation

  1. Clone the repository:
git clone https://github.com/soubai/kubestatus-operator.git
cd kubestatus-operator
  1. Install the CRDs:
kubectl apply -f config/crd/bases
  1. Install the operator:
kubectl apply -f dist/install.yaml

Verify Installation

  1. Check if the operator pod is running:
kubectl get pods -n kubestatus-operator-system
  1. Verify the CRDs are installed:
kubectl get crds | grep kubestatus

Usage

  1. Create a KubeStatus resource:
apiVersion: crd.soubai.me/v1
kind: KubeStatus
metadata:
  name: sample-kubestatus
spec:
  # Add your spec configuration here
  1. Apply the resource:
kubectl apply -f kubestatus-sample.yaml
  1. Check the status:
kubectl get kubestatus sample-kubestatus -o yaml

Configuration

Custom Resource Fields

Field Type Description Required
spec.Namespaces []string List of namesp Yes
spec.Size integer Number of replicas of Kubestatus (default 3) No
spec.ConfigMapName string ConfigMap name used by Kubestatus (default kubestatus-configmap) No

Example Configuration

apiVersion: crd.soubai.me/v1alpha1
kind: KubeStatus
metadata:
  name: kubestatus-operator
  namespace: kubestatus
spec:
  size: 3
  namespaces:
    - default
    - my-app-namespace
  configMapName: kubestatus-configmap

Service annotation

To monitor your services with KubeStatus, you need to add them to the watch list. You can do this by adding a specific annotation to each service you want to monitor:

kubectl annotate svc my-service-name kubestatus/watch='true'

Example

You created this web application based on nginx image.

cat <<EOF | kubectl apply -f -
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
spec:
  selector:
    matchLabels:
      app: nginx
  replicas: 1
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.14.2
        ports:
        - containerPort: 80
EOF

Exposing the web application using k8s service

cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Service
metadata:
  name: web-service
spec:
  selector:
    app: nginx
  ports:
  - port: 80
EOF

Add annotation to web-service:

kubectl annotate svc web-service kubestatus/watch='true'

In order to visit kubestatus status page you can port-forword the Kubestatus service:

kubectl port-forward service/kubestatus-service 8080 -n kubestatus

🚀 Now navigate to http://localhost:8080

Troubleshooting

Common Issues

  1. Operator pod not starting:

    • Check the pod logs:
    kubectl logs -n kubestatus-operator-system deployment/kubestatus-operator-controller-manager -c manager
    • Verify RBAC permissions
  2. Status not updating:

    • Check the operator logs for errors
    • Verify the KubeStatus resource is properly configured

Getting Support

If you encounter any issues:

  • Open an issue on GitHub
  • Check existing issues for solutions
  • Include operator logs and resource definitions when reporting problems

Uninstallation

To remove the KubeStatus Operator from your cluster:

kubectl delete -f dist/install.yaml
kubectl delete -f config/crd/bases

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the Apache License 2.0.

About

kubestatus operator

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages