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

Byi helm yaml #11

Merged
merged 5 commits into from
Apr 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions deploy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Deployment Guide (Draft)

## Prerequisites

* Make sure a Kubernetes cluster is created and you can use `kubectl` to access it.
* Make sure Kubernetes cluster enables the DNS service ([steps](https://kubernetes.io/docs/concepts/services-networking/connect-applications-service/#dns))
* Create HTTP source(s) in your Sumo Logic account and get HTTP Source URL(s).

## Setting up Fluentd

* Download kubernetes .yaml manifest files from GitHub:

```sh
curl -LJO https://raw.githubusercontent.com/SumoLogic/sumologic-kubernetes-collection/master/deploy/kubernetes/fluentd-sumologic.yaml
```

* Open the .yaml file, find line with `endpoint-metrics:`, replace `XXXX` with the URL of HTTP source; save it.
* Apply the .yaml file with `kubectl`:

```sh
kubectl apply -f ./fluentd-sumologic.yaml
```

* Verify the pod(s) are running:

```sh
kubectl -n sumologic get pod
```

## Setting up Prometheus

* Install `helm`:

```sh
brew install kubernetes-helm
```

* Download tiller RBAC .yaml manifest files from GitHub:

```sh
curl -LJO https://raw.githubusercontent.com/SumoLogic/sumologic-kubernetes-collection/master/deploy/helm/tiller-rbac.yaml
```

* Apply the .yaml file with `kubectl` and init tiller:

```sh
kubectl apply -f tiller-rbac.yaml \
&& helm init --service-account tiller
```

* Download Prometheus operator override .yaml files from GitHub:

```sh
curl -LJO https://raw.githubusercontent.com/SumoLogic/sumologic-kubernetes-collection/master/deploy/helm/overrides.yaml
```

* Install the `prometheus-operator` using `helm`:

```sh
helm repo update \
&& helm install stable/prometheus-operator --name prometheus-operator --namespace sumologic -f overrides.yaml
```

__NOTE__: If credentials are created earlier, add `--no-crd-hook` at the end.

* Verify the `prometheus-operator` is running:

```sh
kubectl -n sumologic logs prometheus-prometheus-operator-prometheus-0 prometheus -f
```

## Tearing down

* Delete `prometheus-operator` from the Kubernetes cluster:

```sh
helm del --purge prometheus-operator
```

* Delete `fluentd-sumologic` app:

```sh
kubectl delete -f ./fluentd-sumologic.yaml
```
4 changes: 4 additions & 0 deletions deploy/helm/overrides.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
prometheus:
prometheusSpec:
remoteWrite:
- url: http://fluentd:9888/prometheus.metrics
18 changes: 18 additions & 0 deletions deploy/helm/tiller-rbac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: tiller
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: tiller
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: tiller
namespace: kube-system
Original file line number Diff line number Diff line change
@@ -1,4 +1,58 @@
# Deploy singleton fluentd instance in the whole cluster for aggregating and forwarding to sumologic
---
apiVersion: v1
kind: Namespace
metadata:
name: sumologic
---
apiVersion: v1
kind: Secret
metadata:
name: sumologic
namespace: sumologic
labels:
k8s-app: fluentd-sumologic
type: Opaque
stringData:
endpoint-metrics: XXXX
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: fluentd
subjects:
- kind: ServiceAccount
name: fluentd
namespace: sumologic
roleRef:
kind: ClusterRole
name: fluentd
apiGroup: rbac.authorization.k8s.io
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
name: fluentd
labels:
k8s-app: fluentd-sumologic
rules:
- apiGroups: [""]
resources:
- nodes
- namespaces
- events
- pods
- replicasets
- statefulsets
- deployments
verbs: ["get", "list", "watch"]
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: fluentd
namespace: sumologic
labels:
k8s-app: fluentd-sumologic
---
apiVersion: v1
kind: ConfigMap
Expand Down Expand Up @@ -50,7 +104,7 @@ data:
@type null
</match>
---
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: fluentd
Expand Down Expand Up @@ -127,7 +181,6 @@ metadata:
labels:
k8s-app: fluentd-sumologic
spec:
type: LoadBalancer
selector:
k8s-app: fluentd-sumologic
ports:
Expand All @@ -136,42 +189,3 @@ spec:
targetPort: 9888
protocol: TCP
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: fluentd
subjects:
- kind: ServiceAccount
name: fluentd
namespace: sumologic
roleRef:
kind: ClusterRole
name: fluentd
apiGroup: rbac.authorization.k8s.io
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
name: fluentd
labels:
k8s-app: fluentd-sumologic
rules:
- apiGroups: [""]
resources:
- nodes
- namespaces
- events
- pods
- replicasets
- statefulsets
- deployments
verbs: ["get", "list", "watch"]
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: fluentd
namespace: sumologic
labels:
k8s-app: fluentd-sumologic
---
5 changes: 0 additions & 5 deletions deploy/kubernetes/namespace-sumologic.yaml

This file was deleted.

12 changes: 0 additions & 12 deletions deploy/kubernetes/secret-sumologic.yaml

This file was deleted.