-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1032 from openziti/ha-docs-overview
Add controller clustering reference documentation
- Loading branch information
Showing
18 changed files
with
901 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
label: Configuration | ||
position: 40 | ||
position: 15 | ||
link: | ||
type: doc | ||
id: reference/configuration/conventions |
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,2 +1,2 @@ | ||
label: Reference | ||
position: 40 | ||
position: 10 |
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,6 +1,6 @@ | ||
--- | ||
title: Builtin Config Types | ||
sidebar_position: 10 | ||
sidebar_position: 20 | ||
--- | ||
|
||
## Overview | ||
|
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,2 @@ | ||
label: Controller Clustering | ||
position: 22 |
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,6 @@ | ||
label: Bootstrapping | ||
position: 10 | ||
link: | ||
type: doc | ||
id: reference/ha/bootstrapping/overview | ||
|
95 changes: 95 additions & 0 deletions
95
docusaurus/docs/reference/ha/bootstrapping/certificates.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,95 @@ | ||
--- | ||
sidebar_label: Certificates | ||
sidebar_position: 20 | ||
--- | ||
|
||
# Controller Certificates | ||
|
||
For controllers to communicate and trust one another, they need certificates that have | ||
been generated with the correct attributes and relationships. | ||
|
||
## Glossary | ||
|
||
### SPIFFE ID | ||
|
||
A SPIFFE ID is a specially formatted URI which is intended to be embedded in a certificates. Applications | ||
use these identifiers to figure out the following about the applications connecting to them. | ||
|
||
1. What organization the peer belongs to | ||
1. What type of application the peer is | ||
1. The application's unique identifier | ||
|
||
Controller certificates use SPIFFE IDs to allow the controllers to identify each during mTLS negotiation. | ||
|
||
See [SPIFFE IDs](https://spiffe.io/docs/latest/spiffe-about/spiffe-concepts/#spiffe-id) for more information. | ||
|
||
### Trust domain | ||
|
||
A [trust domain](https://spiffe.io/docs/latest/spiffe-about/spiffe-concepts/#trust-domain) | ||
is the part of a SPIFFE ID that indicates the organization that an identity belongs to. | ||
|
||
## Requirements | ||
|
||
1. The certificates must have a shared root of trust | ||
1. The controller client and server certificates must contain a SPIFFE ID. | ||
1. The SPIFFE ID must be set as the only URI in the `X509v3 Subject Alternative Name` field in the | ||
certificate. | ||
1. The SPIFFE ID must have the following format: `spiffe://<trust domain>/controller/<controller id>` | ||
|
||
So if the trust domain is `example.com` and the controller id is `ctrl1`, then the SPIFFE id | ||
would be: | ||
|
||
``` | ||
spiffe://example.com/controller/ctrl1 | ||
``` | ||
|
||
## Steps to Certificate Creation | ||
There are many ways to set up certificates, so this will just cover an example configuration. | ||
|
||
The primary thing to ensure is that controllers have a shared root of trust. | ||
One way of generating certs would be as follows: | ||
|
||
1. Create a root CA | ||
1. Create an intermediate CA for each controller | ||
1. Issue a server cert using the intermediate CA for each controller | ||
1. Issue a client cert using the intermediate CA for each controller | ||
|
||
## Example | ||
|
||
* The OpenZiti CLI supports creating SPIFFE IDs in certificates | ||
* Use the `--trust-domain` flag when creating CAs | ||
* Use the `--spiffe-id` flag when creating server or client certificates | ||
|
||
Using the OpenZiti PKI tool, certificates for a three node cluster could be created as follows: | ||
|
||
```bash | ||
# Create the trust root, a self-signed CA | ||
ziti pki create ca --trust-domain ha.test --pki-root ./pki --ca-file ca --ca-name 'HA Example Trust Root' | ||
|
||
# Create the controller 1 intermediate/signing cert | ||
ziti pki create intermediate --pki-root ./pki --ca-name ca --intermediate-file ctrl1 --intermediate-name 'Controller One Signing Cert' | ||
|
||
# Create the controller 1 server cert | ||
ziti pki create server --pki-root ./pki --ca-name ctrl1 --dns "localhost,ctrl1.ziti.example.com" --ip "127.0.0.1,::1" --server-name ctrl1 --spiffe-id 'controller/ctrl1' | ||
|
||
# Create the controller 1 server cert | ||
ziti pki create client --pki-root ./pki --ca-name ctrl1 --client-name ctrl1 --spiffe-id 'controller/ctrl1' | ||
|
||
# Create the controller 2 intermediate/signing cert | ||
ziti pki create intermediate --pki-root ./pki --ca-name ca --intermediate-file ctrl2 --intermediate-name 'Controller Two Signing Cert' | ||
|
||
# Create the controller 2 server cert | ||
ziti pki create server --pki-root ./pki --ca-name ctrl2 --dns "localhost,ctrl2.ziti.example.com" --ip "127.0.0.1,::1" --server-name ctrl2 --spiffe-id 'controller/ctrl2' | ||
|
||
# Create the controller 2 client cert | ||
ziti pki create client --pki-root ./pki --ca-name ctrl2 --client-name ctrl2 --spiffe-id 'controller/ctrl2' | ||
|
||
# Create the controller 3 intermediate/signing cert | ||
ziti pki create intermediate --pki-root ./pki --ca-name ca --intermediate-file ctrl3 --intermediate-name 'Controller Three Signing Cert' | ||
|
||
# Create the controller 3 server cert | ||
ziti pki create server --pki-root ./pki --ca-name ctrl3 --dns "localhost,ctrl3.ziti.example.com" --ip "127.0.0.1,::1" --server-name ctrl3 --spiffe-id 'controller/ctrl3' | ||
|
||
# Create the controller 3 client cert | ||
ziti pki create client --pki-root ./pki --ca-name ctrl3 --client-name ctrl3 --spiffe-id 'controller/ctrl3' | ||
``` |
51 changes: 51 additions & 0 deletions
51
docusaurus/docs/reference/ha/bootstrapping/configuration.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,51 @@ | ||
--- | ||
sidebar_label: Configuration | ||
sidebar_position: 30 | ||
--- | ||
|
||
# Controller Configuration | ||
|
||
### Config File | ||
|
||
The controller requires a `cluster` section. | ||
|
||
```yaml | ||
cluster: | ||
dataDir: /path/to/data/dir | ||
``` | ||
The `dataDir` will be used to store the following: | ||
|
||
* `ctrl-ha.db` - the OpenZiti data model bbolt database | ||
* `raft.db` - the Raft bbolt database | ||
* `snapshots/` - a directory to store Raft snapshots | ||
|
||
Controllers use the control channel listener to communicate with each other. Unlike | ||
routers, they need to know how to reach each other, so an advertise address must | ||
be configured. | ||
|
||
```yaml | ||
ctrl: | ||
listener: tls:0.0.0.0:1280 | ||
options: | ||
advertiseAddress: tls:ctrl1.ziti.example.com:1280 | ||
``` | ||
|
||
Finally, cluster-capable SDK clients use OIDC for authentication, so an OIDC endpoint must be configured. | ||
|
||
```yaml | ||
web: | ||
- name: all-apis-localhost | ||
bindPoints: | ||
- interface: 0.0.0.0:1280 | ||
address: ctrl1.ziti.example.com:1280 | ||
options: | ||
minTLSVersion: TLS1.2 | ||
maxTLSVersion: TLS1.3 | ||
apis: | ||
- binding: health-checks | ||
- binding: fabric | ||
- binding: edge-management | ||
- binding: edge-client | ||
- binding: edge-oidc | ||
``` |
37 changes: 37 additions & 0 deletions
37
docusaurus/docs/reference/ha/bootstrapping/initialization.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,37 @@ | ||
--- | ||
sidebar_label: Initialization | ||
sidebar_position: 40 | ||
--- | ||
|
||
# Initializing the First Controller | ||
|
||
First start the controller: | ||
|
||
```shell | ||
ziti controller run </path/to/controller-config.yml> | ||
``` | ||
|
||
Since this controller has not yet been initialized, it does not have an administrator | ||
identity that can be used to manage the network. The controller will pause startup | ||
and wait for initialization. While waiting it will periodically emit a message: | ||
|
||
```buttonless title="Output" | ||
[ 3.323] WARNING ziti/controller/server.(*Controller).checkEdgeInitialized: the | ||
controller has not been initialized, no default admin exists. Add this node to a | ||
cluster using 'ziti agent cluster add tls:ctrl1.ziti.example.com:1280' against an existing | ||
cluster member, or if this is the bootstrap node, run 'ziti agent controller init' | ||
to configure the default admin and bootstrap the cluster | ||
``` | ||
|
||
As this is the first node in the cluster, there's no existing cluster to add it to. | ||
|
||
To add the default administrator, run: | ||
|
||
``` | ||
ziti agent cluster init <admin username> <admin password> <admin identity name> | ||
``` | ||
|
||
This initializes an admin user that can be used to manage the network. | ||
|
||
Once the admin user is created, the controller should be up and running. This is | ||
now a functional HA cluster, albeit with a cluster size of one. |
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,14 @@ | ||
--- | ||
sidebar_label: Overview | ||
sidebar_position: 10 | ||
--- | ||
|
||
# Bootstrapping A Cluster | ||
|
||
To bring up a controller cluster, one starts with a single node. | ||
|
||
Bootstrapping a cluster has the following steps: | ||
|
||
1. [Creating Certificates](certificates.md) | ||
1. [Setting Controller Config](configuration.md) | ||
1. [Controller Initialization](initialization.md) |
Oops, something went wrong.