|
| 1 | +# Splunk |
| 2 | + |
| 3 | +Used for Splunk related testing. |
| 4 | + |
| 5 | +## Installation |
| 6 | + |
| 7 | +### Terraform |
| 8 | + |
| 9 | +Build an AKS cluster: |
| 10 | + |
| 11 | +```bash |
| 12 | +# Init |
| 13 | +cd ./splunk |
| 14 | +terraform init #-upgrade |
| 15 | + |
| 16 | +# Apply |
| 17 | +terraform apply |
| 18 | + |
| 19 | +# Outputs |
| 20 | +terraform output |
| 21 | + |
| 22 | +--- |
| 23 | + |
| 24 | +# Delete |
| 25 | +terraform destroy |
| 26 | +``` |
| 27 | + |
| 28 | +### Splunk Operator |
| 29 | + |
| 30 | +There is a current issue with [Admin Installation for All Namespaces](https://github.com/splunk/splunk-operator/issues/206), |
| 31 | +so use the [non-admin user method](https://github.com/splunk/splunk-operator/blob/develop/docs/Install.md#installation-using-a-non-admin-user). |
| 32 | + |
| 33 | +#### Install |
| 34 | + |
| 35 | +Install the Splunk Operator as a non-admin user. |
| 36 | + |
| 37 | +```bash |
| 38 | +# create namespace |
| 39 | +kubectl create namespace splunk-operator |
| 40 | + |
| 41 | +# an admin needs to install the CRDs |
| 42 | +kubectl apply -f https://github.com/splunk/splunk-operator/releases/download/1.0.1/splunk-operator-crds.yaml |
| 43 | + |
| 44 | +# install splunk operator into namespace |
| 45 | +# v1.0.1 doesnt currently work - I've raised this issue: https://github.com/splunk/splunk-operator/issues/373 |
| 46 | +kubectl apply -f https://github.com/splunk/splunk-operator/releases/download/1.0.1/splunk-operator-noadmin.yaml --namespace splunk-operator |
| 47 | + |
| 48 | + |
| 49 | +# 1.0.0 works |
| 50 | +kubectl apply -f https://github.com/splunk/splunk-operator/releases/download/1.0.0/splunk-operator-crds.yaml |
| 51 | +kubectl apply -f https://github.com/splunk/splunk-operator/releases/download/1.0.0/splunk-operator-noadmin.yaml --namespace splunk-operator |
| 52 | +``` |
| 53 | + |
| 54 | +### Splunk Deployments |
| 55 | + |
| 56 | +After deploying one of the methods below, [get the password](https://github.com/splunk/splunk-operator/blob/develop/docs/Examples.md#reading-global-kubernetes-secret-object) |
| 57 | +by running the following code: |
| 58 | + |
| 59 | +```bash |
| 60 | +# kubectl get secret splunk-<desired_namespace>-secret -o go-template=' {{range $k,$v := .data}}{{printf "%s: " $k}}{{if not $v}}{{$v}}{{else}}{{$v | base64decode}}{{end}}{{"\n"}}{{end}}' |
| 61 | +kubectl get secret --namespace splunk-operator splunk-splunk-operator-secret -o go-template=' {{range $k,$v := .data}}{{printf "%s: " $k}}{{if not $v}}{{$v}}{{else}}{{$v | base64decode}}{{end}}{{"\n"}}{{end}}' |
| 62 | +``` |
| 63 | + |
| 64 | +You can then port-forward to the pod and view the web interface: |
| 65 | + |
| 66 | +```bash |
| 67 | +kubectl port-forward splunk-s1-standalone-0 8000 |
| 68 | +kubectl port-forward --namespace splunk-operator splunk-single-standalone-0 8000 |
| 69 | +``` |
| 70 | + |
| 71 | +#### Standalone |
| 72 | + |
| 73 | +https://github.com/splunk/splunk-operator/blob/develop/docs/Examples.md#creating-a-clustered-deployment |
| 74 | + |
| 75 | +```bash |
| 76 | +cat <<EOF | kubectl apply --namespace splunk-operator -f - |
| 77 | +apiVersion: enterprise.splunk.com/v1 |
| 78 | +kind: Standalone |
| 79 | +metadata: |
| 80 | + name: single |
| 81 | + finalizers: |
| 82 | + - enterprise.splunk.com/delete-pvc |
| 83 | +EOF |
| 84 | +``` |
| 85 | + |
| 86 | +#### Cluster Master and Indexers |
| 87 | + |
| 88 | +https://github.com/splunk/splunk-operator/blob/develop/docs/Examples.md#indexer-clusters |
| 89 | + |
| 90 | +```bash |
| 91 | +# Cluster Master |
| 92 | +cat <<EOF | kubectl apply -f - |
| 93 | +apiVersion: enterprise.splunk.com/v1 |
| 94 | +kind: ClusterMaster |
| 95 | +metadata: |
| 96 | + name: cm |
| 97 | + finalizers: |
| 98 | + - enterprise.splunk.com/delete-pvc |
| 99 | +EOF |
| 100 | + |
| 101 | +# Indexers |
| 102 | +cat <<EOF | kubectl apply -f - |
| 103 | +apiVersion: enterprise.splunk.com/v1 |
| 104 | +kind: IndexerCluster |
| 105 | +metadata: |
| 106 | + name: example |
| 107 | + finalizers: |
| 108 | + - enterprise.splunk.com/delete-pvc |
| 109 | +spec: |
| 110 | + clusterMasterRef: |
| 111 | + name: cm |
| 112 | +EOF |
| 113 | +``` |
0 commit comments