How to install Cozystack in Servers.com

How to install Cozystack in Servers.com

Before installation

Network

Remove Aggregate Interface

  • Go to Dedicated Server - Server Details, and click on the second column (highlighted in blue) to remove the aggregate interface.
  • Ensure the status appears as shown in the screenshot.

Remove Aggregate Interface

Set Up L2 Network

  • Navigate to Networks - L2 Segment and click Add Segment.

L2 Segments

L2 Segments

L2 Segments

First, select Private, choose the region, add the servers, assign a name, and save it.

  • Set the type to Native.

Type

Do the same for Public.

Access

  • Create SSH keys for server access.
  • Go to Identity and Access > SSH and Keys.

SSH

  • Create new keys or add your own.

SSH SSH

Setup OS

Rescue Mode / Access

  • Go to Dedicated Servers - Server Details, and click Reboot to Rescue. Select your SSH key.

Rescue

  • Connect via SSH
    • Log in via SSH using the external IP of the server (Public IP in Details).

Public IP

Interfaces

  • Interface Information
  • You should have received an email from your provider (Servers.com) containing the MAC addresses of the interfaces.
  • Run ip a to view network interfaces.
  • Record the alias names (altname) for the public and private interfaces with uplink information (needed for network configuration).

Setup

Check Disks:

# lsblk

NAME    MAJ:MIN   RM   SIZE     RO   TYPE   MOUNTPOINTS
sda     259:4     0    476.9G   0    disk
sdb     259:0     0    476.9G   0    disk

⚠️ The following commands will erase your data! Wipe disks

sfdisk /dev/sda --delete
sfdisk /dev/sdb --delete
wipefs -a /dev/sda
wipefs -a /dev/sdb

Set environment variable:

DISK=$(lsblk -dn -o NAME,SIZE,TYPE -e 1,7,11,14,15 | sort | sed -n 1p | awk '{print $1}')
echo "DISK=$DISK"

Download Talos Linux asset from the Cozystack’s releases page, and write it into disk:

cd /tmp
wget https://github.com/aenix-io/cozystack/releases/latest/download/metal-amd64.raw.xz
xz -d -c /tmp/metal-amd64.raw.xz | dd of="/dev/$DISK" bs=4M oflag=sync

Resize the partition table and prepare additional partition for the cloud-init data:

# resize gpt partition
sgdisk -e "/dev/$DISK"

# Create 20MB partition in the end of disk
end=$(sgdisk -E "/dev/$DISK")
sgdisk -n7:$(( $end - 40960 )):$end -t7:ef00 "/dev/$DISK"

# Create FAT filesystem for cloud-init and mount it
PARTITION=$(sfdisk -d "/dev/$DISK" | awk 'END{print $1}' | awk -F/ '{print $NF}')
mkfs.vfat -n CIDATA "/dev/$PARTITION"
mount  "/dev/$PARTITION" /mnt

Umount cloud-init partition, sync changes, and reboot the server:

umount /mnt
sync
reboot

Talos Network Configuration for Remote Management

  • Press F3 (network configuration).
  • Go to Interfaces and locate the external interface using the attname from the Interfaces section above.
  • Configure it with the IP address and subnet information from the server details:
    • Public IP (with subnet mask).
    • Gateway.

Public IP Public Networks

Talos Configuration

Installation with Talm

  1. Run the following command to initialize Talm for Cozystack:
talm init -p cozystack

After initializing, generate a configuration template with the command:

talm -n 1.2.3.4 -e 1.2.3.4 template -t templates/controlplane.yaml -i > nodes/node-N.yam 
  1. Edit the node configuration file as needed.

Example configuration:

# talm: nodes=["1.2.3.4"], endpoints=["1.2.3.4"], templates=["templates/controlplane.yaml"]
# THIS FILE IS AUTOGENERATED. DO NOT EDIT IT!
machine:
  type: controlplane
  kubelet:
    extraConfig:
      maxPods: 512
    nodeIP:
      validSubnets:
        - 192.168.100.0/24
  network
    interfaces:
      - deviceSelector:
          busPath: "0000:02:00.1"
        addresses:
          - 1.2.3.4/29
        routes:
          - network: 0.0.0.0/0
            gateway: 1.2.3.3
      - deviceSelector:
          busPath: "0000:02:00.0"
        addresses:
          - 192.168.100.11/24
            vip:
          ip: 192.168.100.10
  install:
    disk: /dev/sdb
    image: ghcr.io/aenix-io/cozystack/talos:v1.8.0
  files:
    - content: "[plugins]\n  [plugins.\"io.containerd.grpc.v1.cri\"]\n    device_ownership_from_security_context = true      \n  [plugins.\"io.containerd.cri.v1.runtime\"]\n    device_ownership_from_security_context = true\n"
      permissions: 0o0
      path: /etc/cri/conf.d/20-customization.part
      op: create
  kernel:
    modules:
      - name: openvswitch
      - name: drbd
        parameters:
          - usermode_helper=disabled
      - name: zfs
      - name: spl
cluster:
  controlPlane:
    endpoint: https://192.168.100.10:6443
  clusterName: aenix-cloud-init
  network:
    cni:
      name: none
    dnsDomain: cozy.local
    serviceSubnets:
      - 10.96.0.0/16
  apiServer:
    certSANs:
      - 127.0.0.1
  controllerManager:
    extraArgs:
      bind-address: 0.0.0.0
  proxy:
    disabled: true
  scheduler:
    extraArgs:
      bind-address: 0.0.0.0
  discovery:
    enabled: false
  etcd:
    advertisedSubnets:
      - 192.168.100.0/24
  allowSchedulingOnControlPlanes: true

YAML

This section isn’t generated automatically:

  1. busPath - Obtained from the “Discovered interfaces busPath” by matching the MAC address of the private interface specified in the provider’s email. (Out of the two interfaces, select the one with the uplink).
  2. addresses - Use the address specified for Layer 2 (L2).

Execution steps:

  1. Run talm apply -f nodeN.yml for all nodes to apply the configurations.
  2. Execute talm bootstrap -f for the first node.
  3. Use talm dashboard -f node1.yml -f node2.yml (or additional files depending on the number of nodes) or kubectl get nodes.

Monitoring: Check the dashboard to see when all nodes reach an operational state.

Have a great day!

Last modified 2024-12-27: Update servers_com.md (#61) (4afcc3c)