Kubernetes Name Schemas

Hostname Schema

Domain TLD Usage

  • Services: example.services
  • Servers (bare metal, VMs, doesn't matter): example.systems
  • Network hardware: example.network

Schema Parts

  • COUNTRY - ISO 3166-1 alpha-3 code, see ISO 3166-1 alpha-3 - Wikipedia and Online Browsing Platform (OBP) - ISO.
  • PROVIDER - 3 character long abbreviation of provider name.
  • DC - Optional info about datacenter/region (e.g., FSN1-DC1).
  • CLUSTER - Cluster designation (in case of Kubernetes, should always have k8s in the beginning) and if there can be multiple a number added (with two digits, e.g., 01, 12).
  • ROLE - In case of Kubernetes, e.g., master, etcd, node (other "special" roles could be, e.g., ingress, stora (could have a suffix per storage software, e.g. storaceph)).
  • COUNT_OR_ID - A count is a special "type". It can for servers that are known to have only a maximum of n machines at maximum, the number of servers padded with zeroes (e.g., max 12 servers results in COUNT for the third machine being 03), in case of nodes where there can be an undefined amount of them it should be a shortid.
    • To generate a "random" ID (requires bashids to be installed):
      bashids \
        -e \
        -s 'B_r1KMOASvn_5A1hDKCdPXJfrIBcddpwOnT5orXYaQPV4Ixb1zNSpa-nF6HOw8mii3pqovZUtsnGZ5pqbf59wPfeMp9XagGXc8ViJreL_5J1kvSnDCPfqvuV2bmGsx4DrVV_ef3Gr3MgCMrX86TGUjCDeJmM3LONAfKIH_vv0ZR9WWcJJbLCc5xnxWh7Is8qNq95ORIHS6iU4gKZNV-LIxdYxd7WyO2fKeOn8kApv0FFD2ydkJXdz4KjqBEcN5Fu' \
        $(date +%s%6N) | \
          tr '[:upper:]' '[:lower:]'

Servers/ VMs Schema

# When country, provider and dc should be omited:
# Examples:
## Master/ Primary Kubernetes node
## Node/ Worker Kubernetes node

# With country, provider and dc in the name:
# Examples:
## `deu-fsn1dc1` translates to Germany, FSN1-DC14 (Falkenstein)
## `deu-fsn1dc1` translates to Germany, FSN1-DC1 (Falkenstein)
## `eee-west2` translates to GCP Region `europe-west2`
## `usa-west1` translates to AWS Region `us-west1`

Script: Gernate Hostname (+ ID)

COUNT_OR_ID="$(sleep 0.00001; \
bashids \
    -e \
    -s 'B_r1KMOASvn_5A1hDKCdPXJfrIBcddpwOnT5orXYaQPV4Ixb1zNSpa-nF6HOw8mii3pqovZUtsnGZ5pqbf59wPfeMp9XagGXc8ViJreL_5J1kvSnDCPfqvuV2bmGsx4DrVV_ef3Gr3MgCMrX86TGUjCDeJmM3LONAfKIH_vv0ZR9WWcJJbLCc5xnxWh7Is8qNq95ORIHS6iU4gKZNV-LIxdYxd7WyO2fKeOn8kApv0FFD2ydkJXdz4KjqBEcN5Fu' \
    $(date +%s%6N) | \
        tr '[:upper:]' '[:lower:]')"
echo "$CLUSTER-$ROLE-$COUNT_OR_ID.example.systems"
echo "$CLUSTER-$ROLE-$COUNT_OR_ID-htz-deu-fsn1dc1.example.systems"
Note: The sleep 0.00001 is used to try to prevent "duplicates" when bashids is run in parallel to generate IDs.

Services Schema


# Examples
## Kubernetes cluster "k8s02" Loadbalancer owned by the "system"
# or the owner can be omitted in such cases
## Kubernetes cluster "k8s02" hosted TeamSpeak service owned by customer "gamer"