New to Searchlight? Please start here.
env prints the list of environment variables in searchlight-operator pods. This check command is used to test Searchlight.
env check command has no variables. Execution of this command can result in following states:
At first, you need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. If you do not already have a cluster, you can create one by using Minikube.
Now, install Searchlight operator in your cluster following the steps here.
To keep things isolated, this tutorial uses a separate namespace called
demo throughout this tutorial. Run the following command to prepare your cluster for this tutorial:
$ kubectl create namespace demo namespace "demo" created $ kubectl get namespaces NAME STATUS AGE default Active 6h kube-public Active 6h kube-system Active 6h demo Active 4m
In this tutorial, we are going to create an alert to check
$ cat ./docs/examples/cluster-alerts/env/demo-0.yaml apiVersion: monitoring.appscode.com/v1alpha1 kind: ClusterAlert metadata: name: env-demo-0 namespace: demo spec: check: env checkInterval: 30s alertInterval: 2m notifierSecretName: notifier-config receivers: - notifier: Mailgun state: CRITICAL to: ["email@example.com"]
$ kubectl apply -f ./docs/examples/cluster-alerts/env/demo-0.yaml clusteralert "env-demo-0" created $ kubectl describe clusteralert env-demo-0 -n demo Name: env-demo-0 Namespace: demo Labels: <none> Events: FirstSeen LastSeen Count From SubObjectPath Type Reason Message --------- -------- ----- ---- ------------- -------- ------ ------- 6m 6m 1 Searchlight operator Warning BadNotifier Bad notifier config for ClusterAlert: "env-demo-0". Reason: secrets "notifier-config" not found 6m 6m 1 Searchlight operator Normal SuccessfulSync Applied ClusterAlert: "env-demo-0"
env command has been synced to Icinga2. Searchlight also logged a warning event, we have not created the notifier secret
notifier-config. Please visit here to learn how to configure notifier secret. Now, open IcingaWeb2 in your browser. You should see a Icinga host
demo@cluster and Icinga service
To cleanup the Kubernetes resources created by this tutorial, run:
$ kubectl delete ns demo
If you would like to uninstall Searchlight operator, please follow the steps here.