2022-07-05 07:42:07 -04:00
# Join Service
2022-05-23 05:36:54 -04:00
2022-07-05 07:42:07 -04:00
Implementation for Constellation's node flow to join an existing cluster.
2022-05-23 05:36:54 -04:00
2022-07-05 07:42:07 -04:00
The join service runs on each control-plane node of the Kubernetes cluster.
2022-09-02 05:52:42 -04:00
New nodes (at cluster start, or later through autoscaling) send an IssueJoinTicket request to the service over [aTLS ](../internal/atls/ ).
2022-07-05 07:42:07 -04:00
The join service verifies the new nodes certificate and attestation statement.
2022-05-23 05:36:54 -04:00
If attestation is successful, the new node is supplied with a disk encryption key for its state disk, and a Kubernetes bootstrap token, so it may join the cluster.
## Packages
2022-07-05 07:42:07 -04:00
### [joinproto](./joinproto/)
2022-05-23 05:36:54 -04:00
2022-07-05 07:42:07 -04:00
Proto definitions for the join service.
2022-05-23 05:36:54 -04:00
2022-07-05 07:42:07 -04:00
### [internal/server](./internal/server/)
2022-05-23 05:36:54 -04:00
The `server` implements gRPC endpoints for joining the cluster and holds the main application logic.
2022-07-05 07:42:07 -04:00
Connections between the join service and joining nodes are secured using [aTLS ](../internal/atls/README.md )
2022-05-23 05:36:54 -04:00
```mermaid
sequenceDiagram
participant New Node
2022-07-05 07:42:07 -04:00
participant Join Service
New Node-->>Join Service: aTLS Handshake (server side verification)
2022-07-14 09:45:04 -04:00
Join Service-->>New Node: #
2022-07-05 07:42:07 -04:00
New Node->>+Join Service: grpc::IssueJoinTicket(DiskUUID, NodeName, IsControlPlane)
Join Service->>+KMS: grpc::GetDataKey(DiskUUID)
KMS->>-Join Service: DiskEncryptionKey
Join Service->>-New Node: [DiskEncryptionKey, KubernetesJoinToken, ...]
2022-05-23 05:36:54 -04:00
```
2022-07-05 07:42:07 -04:00
### [internal/kms](./internal/kms/)
2022-05-23 05:36:54 -04:00
Implements interaction with Constellation's key management service.
This is needed for fetching data encryption keys for joining nodes.
2022-07-05 07:42:07 -04:00
### [internal/kubeadm](./internal/kubeadm/)
2022-05-23 05:36:54 -04:00
Implements interaction with the Kubernetes API to create join tokens for new nodes.
## [Dockerfile](./Dockerfile)
```shell
2022-06-21 05:10:32 -04:00
export VERSION=1.0.0
2022-07-05 07:42:07 -04:00
DOCKER_BUILDKIT=1 docker build --build-arg PROJECT_VERSION=${VERSION} -t ghcr.io/edgelesssys/constellation/join-service:v${VERSION} -f joinservice/Dockerfile .
2022-05-23 05:36:54 -04:00
```