Skip to content

Commit 175e882

Browse files
authored
Merge pull request #49 from krancour/service-type
use ClusterIP as the default service type
2 parents 4505489 + 0af9eb3 commit 175e882

File tree

2 files changed

+59
-44
lines changed

2 files changed

+59
-44
lines changed

README.md

+52-40
Original file line numberDiff line numberDiff line change
@@ -13,46 +13,48 @@ visualizations of those metrics available through a Grafana dashboard.
1313

1414
<br clear="left"/>
1515

16-
Brigade 2 itself is currently in an _beta_ state and remains under active
17-
development, as such, the same is true for this add-on component.
16+
## Installation
1817

19-
## Getting Started
18+
Prerequisites:
2019

21-
Follow these steps to get started.
20+
* A Kubernetes cluster:
21+
* For which you have the `admin` cluster role
22+
* That is already running Brigade 2
23+
* Capable of provisioning a _public IP address_ for a service of type
24+
`LoadBalancer`. (This means you won't have much luck running the gateway
25+
locally in the likes of kind or minikube unless you're able and willing to
26+
mess with port forwarding settings on your router, which we won't be
27+
covering here.)
2228

23-
### Prerequisites
29+
* `kubectl`, `helm` (commands below require Helm 3.7.0+), and `brig` (the
30+
Brigade 2 CLI)
2431

25-
Since Brigade Metrics aggregates and exposes metrics for a running Brigade 2
26-
installation, an operational Brigade 2 installation is a prerequisite.
32+
### 1. Create a Service Account
2733

28-
Note that Brigade Metrics is only compatible with the _beta_ series of Brigade 2
29-
releases.
34+
__Note:__ To proceed beyond this point, you'll need to be logged into Brigade 2
35+
as the "root" user (not recommended) or (preferably) as a user with the `ADMIN`
36+
role. Further discussion of this is beyond the scope of this documentation.
37+
Please refer to Brigade's own documentation.
3038

31-
If necessary, please refer to
32-
[Brigade 2's own getting started documentation](https://github.com/brigadecore/brigade/tree/v2)
33-
for guidance in fulfilling this dependency.
34-
35-
Once Brigade 2 is operational, create a service account for use by Brigade
36-
Metrics:
39+
Using Brigade 2's `brig` CLI, create a service account:
3740

3841
```console
3942
$ brig service-account create \
4043
--id brigade-metrics \
41-
--description "Used by Brigade Metrics"
44+
--description brigade-metrics
4245
```
4346

44-
This command will display a token that Brigade Metrics can use for
45-
authenticating to the Brigade 2 API server. Take note of this value. It will
46-
be required in subsequent steps and cannot be retrieved later through any other
47-
means.
47+
Make note of the __token__ returned. This value will be used in another step.
48+
_It is your only opportunity to access this value, as Brigade does not save it._
4849

49-
Now grant the service account global read permissions:
50+
Authorize this service account with read-only access to Brigade:
5051

5152
```console
52-
$ brig role grant READER --service-account brigade-metrics
53+
$ brig role grant READER \
54+
--service-account brigade-metrics
5355
```
5456

55-
### Installing Brigade Metrics
57+
### 2. Installing Brigade Metrics
5658

5759
For now, we're using the [GitHub Container Registry](https://ghcr.io) (which is
5860
an [OCI registry](https://helm.sh/docs/topics/registries/)) to host our Helm
@@ -95,6 +97,10 @@ minimum, you will need to make the following changes:
9597
* Specify a username and password for the metrics dashboard by setting values
9698
for `grafana.auth.username` and `grafana.auth.password`.
9799

100+
* `grafana.service.type`: If you plan to enable ingress (advanced), you can
101+
leave this as its default -- `ClusterIP`. If you do not plan to enable
102+
ingress, you probably will want to change this value to `LoadBalancer`.
103+
98104
Install Brigade Metrics, referencing your edited configuration:
99105

100106
```console
@@ -103,31 +109,37 @@ $ helm install brigade-metrics \
103109
--version v0.2.0 \
104110
--create-namespace \
105111
--namespace brigade-metrics \
106-
--values ~/brigade-metrics-values.yaml
112+
--values ~/brigade-metrics-values.yaml \
113+
--wait \
114+
--timeout 300s
107115
```
108116

109-
### Accessing the Dashboard
117+
### 3. (RECOMMENDED) Create a DNS Entry
110118

111-
Use the following command to determine when the dashboard (Grafana) is ready:
119+
If you overrode defaults and set `grafana.service.type` to `LoadBalancer`, use
120+
this command to find the gateway's public IP address:
112121

113122
```console
114-
$ kubectl get deployment brigade-metrics-grafana --namespace brigade-metrics
123+
$ kubectl get svc brigade-metrics-grafana \
124+
--namespace brigade-metrics \
125+
--output jsonpath='{.status.loadBalancer.ingress[0].ip}'
115126
```
116127

117-
If you deployed Brigade Metrics on a public cloud _and_ kept the default service
118-
type of `LoadBalancer` for the dashboard, then use the following command to
119-
determine when your dashboard has been assigned a public IP:
128+
If you overrode defaults and enabled support for an ingress controller, you
129+
probably know what you're doing well enough to track down the correct IP without
130+
our help. 😉
120131

121-
```console
122-
$ kubectl get service brigade-metrics-grafana --namespace brigade-metrics
123-
```
132+
With this public IP in hand, edit your name servers and add an `A` record
133+
pointing your domain to the public IP.
134+
135+
### 4. Accessing the Dashboard
124136

125-
The dashboard should be accessible at the public IP using HTTPS. If you used
126-
the default, auto-generated certificate, expect to receive a cert warning.
137+
If you overrode defaults and set `grafana.service.type` to `LoadBalancer`, then
138+
the dashboard should be accessible over HTTPS at the public IP address or DNS
139+
hostname.
127140

128-
If you deployed Brigade Metrics on a local cluster or changed the service type
129-
for the dashboard to something like `ClusterIP`, then use port forwarding to
130-
access the dashboard:
141+
If you kept the default setting of `ClusterIP` for `grafana.service.type`, then
142+
use port forwarding to expose the dashboard on your local network interface:
131143

132144
```console
133145
$ kubectl port-forward \
@@ -136,8 +148,8 @@ $ kubectl port-forward \
136148
8443:443
137149
```
138150

139-
The dashboard should be accessible at `https://localhost:8443`. Expect to
140-
receive a cert warning.
151+
In this case, the dashboard should be accessible at `https://localhost:8443`.
152+
Expect to receive a cert warning.
141153

142154
Log in using the username and password you selected in the previous section.
143155

charts/brigade-metrics/values.yaml

+7-4
Original file line numberDiff line numberDiff line change
@@ -212,12 +212,15 @@ grafana:
212212
tolerations: []
213213

214214
service:
215-
## If you're going to use an ingress controller, you can change the service
216-
## type to CLusterIP.
217-
type: LoadBalancer
215+
## If you're not going to use an ingress controller, you may want to change
216+
## this value to LoadBalancer for production deployments. If running
217+
## locally, you may want to change it to NodePort OR leave it as ClusterIP
218+
## and use `kubectl port-forward` to map a port on the local network
219+
## interface to the service.
220+
type: ClusterIP
218221
## Host port the service will be mapped to when service type is either
219222
## NodePort or LoadBalancer. If not specified, Kubernetes chooses.
220-
# nodePort: 31900
223+
# nodePort:
221224

222225
## All settings for the nginx server
223226
nginx:

0 commit comments

Comments
 (0)