From 874129cc6b2f5dbcf750a4b58f89d22ad72c810e Mon Sep 17 00:00:00 2001
From: Nick Lang <nick@nicklang.com>
Date: Wed, 22 Apr 2020 16:27:48 -0500
Subject: [PATCH 1/3] adding readme for how to deploy elasticstack using helm
 charts

---
 helm/README.md                 | 111 +++++++++++++++++++++++++++++++++
 helm/values/elasticsearch.yaml |   3 +
 2 files changed, 114 insertions(+)
 create mode 100644 helm/README.md
 create mode 100644 helm/values/elasticsearch.yaml

diff --git a/helm/README.md b/helm/README.md
new file mode 100644
index 00000000..c1d9b110
--- /dev/null
+++ b/helm/README.md
@@ -0,0 +1,111 @@
+# Helm
+
+This directory holds the values.yaml for deploying various pre-defined helm charts. 
+
+First off lets assume that helm has already been deployed. 
+
+To install a helm chart it's quite simple:
+
+```
+helm install --name deployment_name --namespace somenamespace chart/name
+```
+
+If we want to specify some overrides to that charge we can specify those as cli arguments, 
+or "more better" we can specify those in values.yaml file. 
+
+```
+helm install -f path/to/values.yaml --name deployment_name --namespace somenamespace chart/name
+```
+
+## Elasticsearch
+
+First off lets deploy Elasticsearch using the 
+[official helm chart](https://github.com/elastic/helm-charts/tree/master/elasticsearch). 
+
+If you haven't added the elastic helm repo you should do that first:
+
+```
+helm repo add elastic https://helm.elastic.co
+```
+
+If you want to practice installing Elasticsearch you can specify a new namespace and delete it when you're done. 
+
+Next let's assume we want to deploy elasticsearch to a testing namespace. Lets call it `test-es`
+
+```
+$ helm install --name elasticsearch --namespace test-es elastic/elasticsearch
+```
+
+Now you can monitor the pods to see if elasticearch is up and ready. 
+
+Now lets say we want to make some changes to the options for deploying elasticsearch. 
+You can create a file in `values` called `Elasticsearch.yaml`. And to deploy these changes
+we just need to run the command: 
+
+```
+$ helm upgrade -f values/elasticsearch.yaml elasticsearch elastic/elasticsearch --namespace test-es
+```
+
+The upgrade process will 1 by 1 take add a new elasticsearch node in to the cluster, wait till the cluster is green
+then remove a node from the cluster, wait till green and so on. 
+
+The upgrade of elasticsearch can be done with 0 downtime using this rolling upgrade procedure. 
+
+This processss can also be used to upgrade elasticsearch to newer versions in the future. 
+
+## Kibana
+
+Deploying kibana is just as simple as deploying elasticsearch. 
+
+Skipping the initial install step like we did with Elasticsearch, lets assume that we already have the values file
+for kibana we wanna use. 
+
+So deploying kibana using a custom values file can be done using: 
+
+```
+helm upgrade -i -f values/kibana.yaml --name kibana --namespace test-es elastic/kibana
+```
+
+We'll note here that this command is slightly different. In this case we are running `upgrade` with the `-i` flag. 
+This means upgrade if a release exists already, if not install it. This command is more idempotent than the first
+command we saw in the [Elasticsearch](./README.md#elasticsearch) section.
+
+### Ingress
+
+Please note that by default the Ingress for Kibana is disabled. 
+If you'd like to enable the ingress for Kibana you must do so explicitly. 
+
+The default configuration for kibana can be found [here](https://github.com/elastic/helm-charts/blob/master/kibana/values.yaml#L105-L116)
+
+In the `values/kibana.yaml` file you must override the Ingress settings to enable an ingress for Kibana. 
+
+### Port Forwarding
+
+In the meantime after kibana has been deployed you can use kubectl's port forwarding to be able to access kibana
+instance using localhost. 
+
+```
+$ kubectl port-forward deployment/kibana-kibana 5601 -n test-es
+```
+
+Now you can access kibana through `http://localhost:5601`
+
+
+## APM Server
+
+Deploying the APM server using a custom values.yaml file would look like: 
+
+```
+helm upgrade -i -f values/apm-server.yaml --name apm-server --namespace test-es elastic/apm-server
+```
+
+
+## Beats
+
+Deploying the metricbeats and filebeats using a custom values.yaml file would look like: 
+
+```
+helm upgrade -i -f values/filebeat.yaml --name filebeat --namespace test-es elastic/filebeat
+helm upgrade -i -f values/metricbeat.yaml --name metricbeat --namespace test-es elastic/metricbeat
+```
+
diff --git a/helm/values/elasticsearch.yaml b/helm/values/elasticsearch.yaml
new file mode 100644
index 00000000..535629da
--- /dev/null
+++ b/helm/values/elasticsearch.yaml
@@ -0,0 +1,3 @@
+---
+
+clusterName: "chime-dev"

From 9cfd9894bb6bc4c39e12ae519edee3c0d533a3e5 Mon Sep 17 00:00:00 2001
From: Nick Lang <nick@nicklang.com>
Date: Wed, 22 Apr 2020 16:39:41 -0600
Subject: [PATCH 2/3] Update helm/values/elasticsearch.yaml

---
 helm/values/elasticsearch.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/helm/values/elasticsearch.yaml b/helm/values/elasticsearch.yaml
index 535629da..4c9c0d79 100644
--- a/helm/values/elasticsearch.yaml
+++ b/helm/values/elasticsearch.yaml
@@ -1,3 +1,3 @@
 ---
 
-clusterName: "chime-dev"
+clusterName: "chime-bus"

From 1e7d5981dca531ebe7d99ea9962522a3b9eadf0f Mon Sep 17 00:00:00 2001
From: Nick Lang <nick@nicklang.com>
Date: Thu, 23 Apr 2020 09:18:04 -0600
Subject: [PATCH 3/3] moving files around

---
 {helm => docs/operations/helm}/README.md     | 7 ++++++-
 {helm => k8s/helm}/values/elasticsearch.yaml | 0
 2 files changed, 6 insertions(+), 1 deletion(-)
 rename {helm => docs/operations/helm}/README.md (86%)
 rename {helm => k8s/helm}/values/elasticsearch.yaml (100%)

diff --git a/helm/README.md b/docs/operations/helm/README.md
similarity index 86%
rename from helm/README.md
rename to docs/operations/helm/README.md
index c1d9b110..06cd8a8f 100644
--- a/helm/README.md
+++ b/docs/operations/helm/README.md
@@ -1,6 +1,6 @@
 # Helm
 
-This directory holds the values.yaml for deploying various pre-defined helm charts. 
+The directory holds the values.yaml for deploying various pre-defined helm charts can be found in `k8s/helm/` 
 
 First off lets assume that helm has already been deployed. 
 
@@ -99,6 +99,9 @@ Deploying the APM server using a custom values.yaml file would look like:
 helm upgrade -i -f values/apm-server.yaml --name apm-server --namespace test-es elastic/apm-server
 ```
 
+Like Kibana the APM server is configured without an ingress. This should not be exposed publicly, except in the case
+where you want to collect APM data from an application that's running outside of the k8s cluster. 
+Even in that event, I would suggest, deploying that app to k8s instead. 
 
 ## Beats
 
@@ -109,3 +112,5 @@ helm upgrade -i -f values/filebeat.yaml --name filebeat --namespace test-es elas
 helm upgrade -i -f values/metricbeat.yaml --name metricbeat --namespace test-es elastic/metricbeat
 ```
 
+Metricbeat and filebeat are both configured by default to start pulling metrics/logs from the k8s cluster and ship to the local Elasticsearch instance. 
+
diff --git a/helm/values/elasticsearch.yaml b/k8s/helm/values/elasticsearch.yaml
similarity index 100%
rename from helm/values/elasticsearch.yaml
rename to k8s/helm/values/elasticsearch.yaml