eks-anywhere icon indicating copy to clipboard operation
eks-anywhere copied to clipboard

Bare-Metal EKS TinkerbellMachineConfig templateRef

Open rade4404 opened this issue 3 years ago • 1 comments
trafficstars

We are experimenting with Bare-Metal EKS and would like to configure network-bonding for the Ubuntu Control Plane and Worker nodes. We have made a custom TinkerbellTemplateConfig with just the actions we would like to apply. We have also updated the TinkerbellMachineConfig.templateRef with the kind and name settings. Will this just append our settings to the end of the template or do we need to copy the example Ubuntu TinkerbellTemplateConfig and apply all of those changes, plus ours? If we do need to override the entire file, is the example Ubuntu Template in the doc's the full config? The Code below is the additional config we would like to append. Thanks.

`---
apiVersion: anywhere.eks.amazonaws.com/v1alpha1
kind: TinkerbellTemplateConfig
metadata:
  name: bonded-nic-template
spec:
  template:
    global_timeout: 6000
    id: ""
    name: bonded-nic-template
    tasks:
    - actions:
      - environment:
          CONTENTS: |
            network:
              version: 2
              renderer: networkd
              ethernets:
                eports:
                  match:
                    name: eno*
              bonds:
                bond0:
                  interfaces: [eports]
                  gateway4: 10.10.10.1
                  nameservers:
                    addresses: [8.8.8.8, 10.10.10.100]
                  parameters:
                    mode: active-backup
                    mii-monitor-interval: 100
                  dhcp4: true
                  primary: true
          DEST_DISK: /dev/sda2
          DEST_PATH: /etc/netplan/config.yaml
          DIRMODE: "0755"
          FS_TYPE: ext4
          GID: "0"
          MODE: "0644"
          UID: "0"
        image: public.ecr.aws/eks-anywhere/tinkerbell/hub/writefile:6c0f0d437bde2c836d90b000312c8b25fa1b65e1-eks-a-11
        name: write-netplan
        timeout: 90
      - environment:
          DEST_DISK: /dev/sda2
          CMD_LINE: modprobe bonding && netplan apply
          DEFAULT_INTERPRETER: /bin/sh -c
          FS_TYPE: ext4
        image: public.ecr.aws/eks-anywhere/tinkerbell/hub/cexec:6c0f0d437bde2c836d90b000312c8b25fa1b65e1-eks-a-11
        name: nic-bonding-setup
        timeout: 90
    version: "0.1"`

rade4404 avatar Jul 11 '22 13:07 rade4404

If you provide a TinkerbellTemplateConfig for a machine, it will override the default template.

If you want to use this custom config, you will need to add the stream-image action, the write cloud-init actions and either kexec or reboot action. Here's what the template would look like with the custom actions that you have added. Note that you will have to manually populate metadata_urls in add-tink-cloud-init-config action

apiVersion: anywhere.eks.amazonaws.com/v1alpha1
kind: TinkerbellTemplateConfig
metadata:
  name: bonded-nic-template
spec:
  template:
    global_timeout: 6000
    id: ""
    name: bonded-nic-template
    tasks:
    - actions:
      - environment:
          COMPRESSED: "true"
          DEST_DISK: /dev/sda
          # this IMG_URL is for ubuntu 1.22 image. If you are using a different K8S version, you will have to change this url
          IMG_URL: https://anywhere-assets.eks.amazonaws.com/releases/bundles/11/artifacts/raw/1-22/ubuntu-v1.22.10-eks-d-1-22-8-eks-a-11-amd64.gz
        image: public.ecr.aws/eks-anywhere/tinkerbell/hub/image2disk:6c0f0d437bde2c836d90b000312c8b25fa1b65e1-eks-a-11
        name: stream-image
        timeout: 360
      - environment:
          CONTENTS: |
            network:
              version: 2
              renderer: networkd
              ethernets:
                eports:
                  match:
                    name: eno*
              bonds:
                bond0:
                  interfaces: [eports]
                  gateway4: 10.10.10.1
                  nameservers:
                    addresses: [8.8.8.8, 10.10.10.100]
                  parameters:
                    mode: active-backup
                    mii-monitor-interval: 100
                  dhcp4: true
                  primary: true
          DEST_DISK: /dev/sda2
          DEST_PATH: /etc/netplan/config.yaml
          DIRMODE: "0755"
          FS_TYPE: ext4
          GID: "0"
          MODE: "0644"
          UID: "0"
        image: public.ecr.aws/eks-anywhere/tinkerbell/hub/writefile:6c0f0d437bde2c836d90b000312c8b25fa1b65e1-eks-a-11
        name: write-netplan
        timeout: 90
      - environment:
          DEST_DISK: /dev/sda2
          CMD_LINE: modprobe bonding && netplan apply
          DEFAULT_INTERPRETER: /bin/sh -c
          FS_TYPE: ext4
        image: public.ecr.aws/eks-anywhere/tinkerbell/hub/cexec:6c0f0d437bde2c836d90b000312c8b25fa1b65e1-eks-a-11
        name: nic-bonding-setup
        timeout: 90
      - environment:
          # add metadata_urls in the list under CONTENTS
          CONTENTS: |
            datasource:
              Ec2:
                metadata_urls: [<admin-machine-ip>, <tinkerbell-ip-from-clusterconfig>]
                strict_id: false
            manage_etc_hosts: localhost
            warnings:
              dsid_missing_source: off
          DEST_DISK: /dev/sda2
          DEST_PATH: /etc/cloud/cloud.cfg.d/10_tinkerbell.cfg
          DIRMODE: "0700"
          FS_TYPE: ext4
          GID: "0"
          MODE: "0600"
          UID: "0"
        image: public.ecr.aws/eks-anywhere/tinkerbell/hub/writefile:6c0f0d437bde2c836d90b000312c8b25fa1b65e1-eks-a-11
        name: add-tink-cloud-init-config
        timeout: 90
      - environment:
          CONTENTS: |
            datasource: Ec2
          DEST_DISK: /dev/sda2
          DEST_PATH: /etc/cloud/ds-identify.cfg
          DIRMODE: "0700"
          FS_TYPE: ext4
          GID: "0"
          MODE: "0600"
          UID: "0"
        image: public.ecr.aws/eks-anywhere/tinkerbell/hub/writefile:6c0f0d437bde2c836d90b000312c8b25fa1b65e1-eks-a-11
        name: add-tink-cloud-init-ds-config
        timeout: 90
      - environment:
          BLOCK_DEVICE: /dev/sda2
          FS_TYPE: ext4
        image: public.ecr.aws/eks-anywhere/tinkerbell/hub/kexec:6c0f0d437bde2c836d90b000312c8b25fa1b65e1-eks-a-11
        name: kexec-image
        pid: host
        timeout: 90
      name: custom-actions
      volumes:
      - /dev:/dev
      - /dev/console:/dev/console
      - /lib/firmware:/lib/firmware:ro
      worker: '{{.device_1}}'
    version: "0.1"

abhinavmpandey08 avatar Jul 11 '22 14:07 abhinavmpandey08