Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About deploying wazuh on k8s (kubeadmin) #622

Open
xuhuajie990 opened this issue Mar 6, 2024 · 2 comments
Open

About deploying wazuh on k8s (kubeadmin) #622

xuhuajie990 opened this issue Mar 6, 2024 · 2 comments

Comments

@xuhuajie990
Copy link

xuhuajie990 commented Mar 6, 2024

environmental information:

kubeadmin deploys k8s

Use nfs as provisioner

Deployment steps:

  1. git clone https://github.com/wazuh/wazuh-kubernetes.git

  2. Create SC, PVC, and PV in the local k8s environment and use nfs. The configuration is as follows:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: wazuh-nfs-pvc
namespace: wazuh
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 500Gi
storageClassName: wazuh-nfs-sc

apiVersion: v1
kind: PersistentVolume
metadata:
name: wazuh-nfs-pv
namespace: wazuh
spec:
storageClassName: wazuh-nfs-sc
claimRef:
name: wazuh-nfs-pvc
namespace: wazuh
accessModes:
ReadWriteMany
capacity:
storage: 500Gi
persistentVolumeReclaimPolicy: Retain
nfs:
server: 192.168.2.8
path: "/data/nfs/wazuh/server"

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: wazuh-nfs-sc
provisioner: nfs
reclaimPolicy: Retain
volumeBindingMode: WaitForFirstConsumer

  1. Modify storage-class.yaml under local-env:

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: wazuh-nfs-sc
namespace: wazuh

provisioner: nfs
reclaimPolicy: Retain
volumeBindingMode: WaitForFirstConsumer

  1. Execute manifest creation:

kubectl apply -k envs/local-env/

  1. The pod cannot be started and is in the pending state. The reason is that the PVC does not have Bind.

/d/h/w/w/e/local-env# kubectl get pod -n wazuh
NAME READY STATUS RESTARTS AGE
wazuh-dashboard-7cfc7d959-prkqs 1/1 Running 0 33m
wazuh-indexer-0 0/1 Pending 0 33m
wazuh-manager-master-0 0/1 Pending 0 33m
wazuh-manager-worker-0 0/1 Pending 0 33m

kubectl describe pod wazuh-manager-master-0 -n wazuh

Events:
Type Reason Age From Message


Warning FailedScheduling 28m (x3 over 33m) default-scheduler 0/3 nodes are available: pod has unbound immediate PersistentVolumeClaims. preemption: 0/3 nodes are available: 3 Preemption is not helpful for scheduling..
Warning FailedScheduling 8m35s (x2 over 18m) default-scheduler running PreBind plugin "VolumeBinding": binding volumes: timed out waiting for the condition

Because I am deploying on local k8s, creating a dynamic PVC is not successful. Is it an environmental problem? How to configure an existing PVC?

@henika1
Copy link

henika1 commented Apr 24, 2024

did you find a solution ?

@Cloud2004
Copy link

Cloud2004 commented May 10, 2024

The solution I found to work was use NFS CSI driver for Kubernetes as your StorageClass then edit:

wazuh/indexer_stack/wazuh-indexer/cluster/indexer-sts.yaml
wazuh/wazuh_managers/wazuh-master-sts.yaml
wazuh/wazuh_managers/wazuh-worker-sts.yaml

storageClassName: wazuh-storage
to
storageClassName: nfs-csi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants