33# Customize the namespace, ingress, and other settings for your environment
44#
55# To retrieve the generated Splunk password after deployment:
6- # kubectl get secret splunk-secret -n <your-namespace> -o jsonpath='{.data.password}' | base64 -d
6+ # kubectl get secret splunk-secret -n splunk-caca -o jsonpath='{.data.password}' | base64 -d
77
8+ ---
9+ # Namespace for CACA test environment
10+ apiVersion : v1
11+ kind : Namespace
12+ metadata :
13+ name : splunk-caca
14+ ---
15+ # ServiceAccount for the password generator job
16+ apiVersion : v1
17+ kind : ServiceAccount
18+ metadata :
19+ name : splunk-password-generator
20+ namespace : splunk-caca
21+ ---
22+ # Role to allow creating/updating secrets
23+ apiVersion : rbac.authorization.k8s.io/v1
24+ kind : Role
25+ metadata :
26+ name : splunk-secret-manager
27+ namespace : splunk-caca
28+ rules :
29+ - apiGroups : [""]
30+ resources : ["secrets"]
31+ verbs : ["get", "create", "update", "patch"]
32+ ---
33+ # RoleBinding to grant the service account permission
34+ apiVersion : rbac.authorization.k8s.io/v1
35+ kind : RoleBinding
36+ metadata :
37+ name : splunk-password-generator
38+ namespace : splunk-caca
39+ subjects :
40+ - kind : ServiceAccount
41+ name : splunk-password-generator
42+ namespace : splunk-caca
43+ roleRef :
44+ kind : Role
45+ name : splunk-secret-manager
46+ apiGroup : rbac.authorization.k8s.io
847---
948# Job to generate a random password for Splunk
1049# This runs before the deployment and creates/updates the secret with a random password
1150apiVersion : batch/v1
1251kind : Job
1352metadata :
1453 name : splunk-password-generator
15- namespace : default # Change to your namespace
54+ namespace : splunk-caca
1655spec :
1756 ttlSecondsAfterFinished : 100 # Auto-cleanup after 100 seconds
1857 template :
1958 spec :
20- serviceAccountName : default # Ensure the service account has permission to create secrets
59+ serviceAccountName : splunk-password-generator # Use the service account with permissions
2160 restartPolicy : Never
2261 containers :
2362 - name : generate-password
@@ -37,13 +76,27 @@ spec:
3776 echo "Password secret created/updated successfully"
3877 echo "Retrieve with: kubectl get secret splunk-secret -o jsonpath='{.data.password}' | base64 -d"
3978 ---
79+ # PersistentVolumeClaim for Splunk data
80+ apiVersion : v1
81+ kind : PersistentVolumeClaim
82+ metadata :
83+ name : splunk
84+ namespace : splunk-caca
85+ spec :
86+ accessModes :
87+ - ReadWriteOnce
88+ resources :
89+ requests :
90+ storage : 10Gi # Adjust size as needed
91+ # storageClassName: your-storage-class # Uncomment and specify if needed
92+ ---
4093apiVersion : apps/v1
4194kind : Deployment
4295metadata :
4396 name : splunk
4497 labels :
4598 app : splunk
46- namespace : default # Change to your namespace
99+ namespace : splunk-caca
47100spec :
48101 replicas : 1
49102 strategy :
@@ -185,7 +238,7 @@ apiVersion: v1
185238kind : Service
186239metadata :
187240 name : splunk-http
188- namespace : default # Change to your namespace
241+ namespace : splunk-caca
189242 labels :
190243 app : splunk
191244spec :
@@ -200,7 +253,7 @@ apiVersion: v1
200253kind : Service
201254metadata :
202255 name : splunk-hec
203- namespace : default # Change to your namespace
256+ namespace : splunk-caca
204257 labels :
205258 app : splunk
206259spec :
@@ -215,7 +268,7 @@ apiVersion: v1
215268kind : Service
216269metadata :
217270 name : splunk-indexer
218- namespace : default # Change to your namespace
271+ namespace : splunk-caca
219272 labels :
220273 app : splunk
221274spec :
0 commit comments