Skip to content

Commit

Permalink
update yaml files
Browse files Browse the repository at this point in the history
  • Loading branch information
Bin Yi committed Apr 12, 2019
1 parent 46d16b7 commit 80c614f
Show file tree
Hide file tree
Showing 6 changed files with 162 additions and 59 deletions.
82 changes: 82 additions & 0 deletions deploy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Deployment Guide (Draft)

## Rre-requests

* Make sure a Kubernetes cluster is created and you can use `kubectl` to access it.
* Create HTTP source(s) in your Sumo Logic account and get HTTP Source URL(s).
* Run `echo -n '<YOUR_HTTP_URL>' | base64` to encode URL.

## 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 encoded URL; 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
```

* 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,60 @@
# 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
data:
# value is base-64 encoded, using following command to get it
# echo -n 'plaintext' | base64
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 +106,7 @@ data:
@type null
</match>
---
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: fluentd
Expand Down Expand Up @@ -127,7 +183,6 @@ metadata:
labels:
k8s-app: fluentd-sumologic
spec:
type: LoadBalancer
selector:
k8s-app: fluentd-sumologic
ports:
Expand All @@ -136,42 +191,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.

0 comments on commit 80c614f

Please sign in to comment.