-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Development][Add] Added support for keystore in elasticsearch (#44)
* Added support for elastic keystore Signed-off-by: iamabhishek-dubey <[email protected]> * Added support for elastic keystore Signed-off-by: iamabhishek-dubey <[email protected]> * Added example for keystore Signed-off-by: iamabhishek-dubey <[email protected]> * Updated documentation for v0.4.0 Signed-off-by: iamabhishek-dubey <[email protected]> Signed-off-by: iamabhishek-dubey <[email protected]>
- Loading branch information
1 parent
c1a2a62
commit d403e94
Showing
17 changed files
with
276 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
docs/content/en/docs/Advance Configuration/Elasticsearch/_index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
title: "Elasticsearch" | ||
linkTitle: "Elasticsearch" | ||
weight: 4 | ||
description: > | ||
Advance configuration information for Elasticsearch | ||
--- |
65 changes: 65 additions & 0 deletions
65
docs/content/en/docs/Advance Configuration/Elasticsearch/keystore.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
--- | ||
title: "Keystore Integration" | ||
linkTitle: "Keystore Integration" | ||
weight: 6 | ||
description: > | ||
Keystore integration configuration for elasticsearch | ||
--- | ||
|
||
## Keystore integation | ||
|
||
Keystore is a recommended way of integrating different credentials like:- AWS, GCP, Azure and Slack, etc. to elasticsearch cluster. We simply need to create a Kubernetes secret and the operator can take care the integration of Kubernetes secret to elasticsearch keystore. | ||
|
||
```shell | ||
$ kubectl create secret generic slack-hook \ | ||
--from-literal=xpack.notification.slack.account.monitoring.secure_url='https://hooks.slack.com/services/asdasdasd/asda' | ||
``` | ||
|
||
or yaml file is also one of the way for creating the secret. | ||
|
||
```yaml | ||
--- | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: encryption-key | ||
data: | ||
xpack.notification.slack.account.monitoring.secure_url: aHR0cHM6Ly9ob29rcy5zbGFjay5jb20vc2VydmljZXMvYXNkYXNkYXNkL2FzZGFzZGFzL2FzZGFzZA== | ||
# other secrets key value pairs can be defined here | ||
type: Opaque | ||
``` | ||
Then simply we can define the keystore secret name in CRD definition. | ||
```yaml | ||
--- | ||
apiVersion: logging.logging.opstreelabs.in/v1beta1 | ||
kind: Elasticsearch | ||
metadata: | ||
name: elasticsearch | ||
spec: | ||
esClusterName: "prod" | ||
esVersion: "7.16.0" | ||
esKeystoreSecret: encryption-key | ||
``` | ||
Validation of keystore can be done using `elasticsearch-keystore` command. | ||
|
||
```shell | ||
$ kubectl exec -it elasticsearch-master-0 -n ot-operators -- ./bin/elasticsearch-keystore list | ||
... | ||
keystore.seed | ||
xpack.notification.slack.account.monitoring.secure_url | ||
``` | ||
|
||
## Helm Configuration | ||
|
||
Keystore integration can also be done using helm chart of elasticsearch. We just need to define the keystore secret name in the values file of elasticsearch helm chart. | ||
|
||
https://github.com/OT-CONTAINER-KIT/helm-charts/blob/main/charts/elasticsearch/values.yaml#L9 | ||
|
||
```shell | ||
$ helm upgrade elasticsearch ot-helm/elasticsearch --namespace ot-operators \ | ||
--set esMaster.storage.storageClass=do-block-storage \ | ||
--set esData.storage.storageClass=do-block-storage --install | ||
``` |
53 changes: 53 additions & 0 deletions
53
docs/content/en/docs/Advance Configuration/Elasticsearch/plugins.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
--- | ||
title: "Plugins Management" | ||
linkTitle: "Plugins Management" | ||
weight: 5 | ||
description: > | ||
Plugins related configuration for elasticsearch | ||
--- | ||
|
||
## Plugins Installation | ||
|
||
Plugins installation has been simplified using the Logging Operator. To install the plugins inside the elasticsearch, we just need to define the list of plugins inside the `esPlugins` section of elasticsearch CRD. | ||
|
||
For example:- | ||
|
||
```yaml | ||
--- | ||
apiVersion: logging.logging.opstreelabs.in/v1beta1 | ||
kind: Elasticsearch | ||
metadata: | ||
name: elasticsearch | ||
spec: | ||
esClusterName: "prod" | ||
esVersion: "7.16.0" | ||
esPlugins: ["repository-s3"] | ||
``` | ||
Validation of plugin installation can be done using `elasticsearch-plugin` or `curl` command. | ||
|
||
```shell | ||
$ kubectl exec -it elasticsearch-master-0 -n ot-operators -- ./bin/elasticsearch-plugin list | ||
... | ||
repository-s3 | ||
``` | ||
|
||
```shell | ||
$ kubectl exec -it elasticsearch-master-0 -n ot-operators -- curl http://localhost:9200/_cat/plugins | ||
... | ||
elasticsearch-master-1 repository-s3 7.16.0 | ||
elasticsearch-master-2 repository-s3 7.16.0 | ||
elasticsearch-master-0 repository-s3 7.16.0 | ||
``` | ||
|
||
## Helm Configuration | ||
|
||
Plugin installation can also be done using helm chart of elasticsearch. We just need to define the plugins list in the values file of elasticsearch helm chart. | ||
|
||
https://github.com/OT-CONTAINER-KIT/helm-charts/blob/main/charts/elasticsearch/values.yaml#L8 | ||
|
||
```shell | ||
$ helm upgrade elasticsearch ot-helm/elasticsearch --namespace ot-operators \ | ||
--set esMaster.storage.storageClass=do-block-storage \ | ||
--set esData.storage.storageClass=do-block-storage --install | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
title: "Advance Configuration" | ||
linkTitle: "Advance Configuration" | ||
weight: 4 | ||
description: > | ||
Advance configuration information for Logging Operator | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
--- | ||
title: "Release History" | ||
linkTitle: "Release History" | ||
weight: 5 | ||
weight: 6 | ||
description: > | ||
Release history information for MongoDB | ||
Release history information for Logging Operator | ||
--- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,4 @@ menu: | |
weight: 20 | ||
--- | ||
|
||
All of Logging Operator documentation | ||
All the Logging Operator documentation and examples. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
apiVersion: logging.logging.opstreelabs.in/v1beta1 | ||
kind: Elasticsearch | ||
metadata: | ||
name: elasticsearch | ||
spec: | ||
esClusterName: "prod" | ||
esVersion: "7.16.0" | ||
esKeystoreSecret: encryption-key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
apiVersion: v1 | ||
data: | ||
xpack.notification.slack.account.monitoring.secure_url: aHR0cHM6Ly9ob29rcy5zbGFjay5jb20vc2VydmljZXMvYXNkYXNkYXNkL2FzZGFzZGFzL2FzZGFzZA== | ||
# other secrets key value pairs can be defined here | ||
kind: Secret | ||
metadata: | ||
name: encryption-key | ||
type: Opaque |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
Copyright 2022 Opstree Solutions. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package k8sgo | ||
|
||
const keyStoreCommand = `set -euo pipefail | ||
elasticsearch-keystore create | ||
for i in /tmp/keystoreSecrets/*/*; do | ||
key=$(basename $i) | ||
echo "Adding file $i to keystore key $key" | ||
elasticsearch-keystore add-file "$key" "$i" | ||
done | ||
# Add the bootstrap password since otherwise the Elasticsearch entrypoint tries to do this on startup | ||
if [ ! -z ${ELASTIC_PASSWORD+x} ]; then | ||
echo 'Adding env $ELASTIC_PASSWORD to keystore as key bootstrap.password' | ||
echo "$ELASTIC_PASSWORD" | elasticsearch-keystore add -x bootstrap.password | ||
fi | ||
cp -a /usr/share/elasticsearch/config/elasticsearch.keystore /tmp/keystore/` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters