Kustomize Examples
___ TODO MAKE DOCUMENTATION ___
sxcollector can be deployed in every kubernetes cluster using the kustomize structure.
You can load the sxcollector using kubectl apply -k if you use a working copy of the
sxcollector in your manager node.
Requirements
Clone the sxcollector repository
git clone https://gitlab.com/startx1/k8s/sxcollector.git
Go to the kustomize structure
cd sxcollector/examples/kustomize
Connect to your kubernetes cluster
Connect to a cluster
Kubernetes cluster
kubectl \
config set-credentials \
mycluster/myuser \
--username=kubeuser \
--password=kubepassword
kubectl \
config set-cluster \
mycluster \
--insecure-skip-tls-verify=true \
--server=https://mycluster.kubernetes.com
kubectl \
config set-context \
mycluster/myuser \
--user=mycluster/myuser \
--namespace=default \
--cluster=mycluster
kubectl \
config use-context \
mycluster/myuser
Openshift cluster
oc login \
--username=kubeuser \
--password=kubepassword \
https://mycluster.openshift.com
Default
You can change the default kubeconfig using environment variable
export KUBECONFIG=/home/user/mykubeconfig
By default the /home/user/.kube/config file will be used. ensure that the default context is connected and can interact with a kubernetes cluster.
Deploy SXCollector
Full default
Deploy all the stack in the sxcollector namespace.
kubectl apply -k .
Full demo
Deploy all the stack in the sxcollector-demo namespace.
kubectl apply -k overlays/
Step-by-step
Create the namespace
Is done by the operator (single-namespaced operator).
create the following components :
- namespace : sxcollector
- serviceaccount : sxcollector-runner in sxcollector NS
Configure SXCollector
You must create a structure to configure the sxcollector various jobs to work. 2 examples of configuration are provided :
- config-mail: Define various kind of environements variables in order to send CSV using email replays
kubectl apply -k overlays/config-mail/
- config-tab : Define default environments variables in order to display Tabulated content into jobs outputs
kubectl apply -k overlays/config-tab/
create the following components :
- secret : sxcollector
Deploy jobs examples
kubectl apply -k base/sxcollectorTask
create the following components :
- jobs : node-info-instant in sxcollector NS
Deploy cronjobs examples
kubectl apply -k base/sxcollectorSchedule
create the following components :
- cronjobs : node-conso-mail-monthly in sxcollector NS
Deploy debugger
If you whan, you can deploy a deployment using the same configuration (image, secret)
as the jobs and cronjobs instances. It will run as a sleeping daemon unless you
use it manually (kubectl rsh …) in order to execute sxcollector commands manually.
kubectl apply -k base/sxcollectorDaemon
create the following components :
- deployment : sxcollector-debug