constellation/joinservice
Malte Poll 260d2571c1 Only upload kubeadm certs if key is rotated
Co-authored-by: Daniel Weiße <66256922+daniel-weisse@users.noreply.github.com>
Co-authored-by: 3u13r <lc@edgeless.systems>
2022-07-14 17:25:18 +02:00
..
cmd Only upload kubeadm certs if key is rotated 2022-07-14 17:25:18 +02:00
internal Only upload kubeadm certs if key is rotated 2022-07-14 17:25:18 +02:00
joinproto Simplify joinproto 2022-07-14 17:25:18 +02:00
Dockerfile Simplify joinproto 2022-07-14 17:25:18 +02:00
README.md Create internal package for joinservice 2022-07-14 17:25:18 +02:00

Join Service

Implementation for Constellation's node flow to join an existing cluster.

The join service runs on each control-plane node of the Kubernetes cluster. New nodes (at cluster start, or later through autoscaling) send an IssueJoinTicket request to the service over aTLS. The join service verifies the new nodes certificate and attestation statement. 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.

The join service uses klog v2 for logging. Use the -v flag to set the log verbosity level. Use different verbosity levels during development depending on the information:

  • 2 for information that should always be logged. Examples: server starting, new gRPC request.

  • 4 for general logging. If you are unsure what log level to use, use 4.

  • 6 for low level information logging. Example: values of new expected measurements

  • Potentially sensitive information, such as return values of functions should never be logged.

Packages

joinproto

Proto definitions for the join service.

internal/server

The server implements gRPC endpoints for joining the cluster and holds the main application logic.

Connections between the join service and joining nodes are secured using aTLS

sequenceDiagram
    participant New Node
    participant Join Service
    New Node-->>Join Service: aTLS Handshake (server side verification)
    Join Service-->>New Node:
    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, ...]

internal/kms

Implements interaction with Constellation's key management service. This is needed for fetching data encryption keys for joining nodes.

internal/kubeadm

Implements interaction with the Kubernetes API to create join tokens for new nodes.

internal/validator

A wrapper for the more generic atls.Validator, allowing for updates to the underlying validator without having to restart the service.

Dockerfile

export VERSION=1.0.0
DOCKER_BUILDKIT=1 docker build --build-arg PROJECT_VERSION=${VERSION} -t ghcr.io/edgelesssys/constellation/join-service:v${VERSION} -f joinservice/Dockerfile .