Skip to main content
Skip table of contents

Pre-provisioned Set Infrastructure

The Konvoy component of DKP needs to know how to access your cluster hosts so you must define the cluster hosts and infrastructure. This is done using inventory resources. For initial cluster creation, you must define a control-plane and at least one worker pool for both air-gapped and non-air-gapped environments.

Define your Infrastructure

  1. Export the following environment variables, ensuring that all control plane and worker nodes are included:

    CODE
    export CLUSTER_NAME=<preprov cluster name>
    export CONTROL_PLANE_1_ADDRESS=<control-plane-address-1>
    export CONTROL_PLANE_2_ADDRESS=<control-plane-address-2>
    export CONTROL_PLANE_3_ADDRESS=<control-plane-address-3>
    export WORKER_1_ADDRESS=<worker-address-1>
    export WORKER_2_ADDRESS=<worker-address-2>
    export WORKER_3_ADDRESS=<worker-address-3>
    export WORKER_4_ADDRESS=<worker-address-4>
    export SSH_USER=<ssh-user>
    export SSH_PRIVATE_KEY_SECRET_NAME=$CLUSTER_NAME-ssh-key
  2. Use the following template to help you define your infrastructure. The environment variables that you set in the previous step automatically replace the variable names when the file is created.

    CODE
    cat <<EOF > preprovisioned_inventory.yaml
    ---
    apiVersion: infrastructure.cluster.konvoy.d2iq.io/v1alpha1
    kind: PreprovisionedInventory
    metadata:
      name: ${CLUSTER_NAME}-control-plane
      namespace: default
      labels:
        cluster.x-k8s.io/cluster-name: ${CLUSTER_NAME}
        clusterctl.cluster.x-k8s.io/move: ""
    spec:
      hosts:
        # Create as many of these as needed to match your infrastructure
        # Note that the command line parameter --control-plane-replicas determines how many control plane nodes will actually be used.
        #
        - address: ${CONTROL_PLANE_1_ADDRESS}
        - address: ${CONTROL_PLANE_2_ADDRESS}
        - address: ${CONTROL_PLANE_3_ADDRESS}
      sshConfig:
        port: 22
        # This is the username used to connect to your infrastructure. This user must be root or
        # have the ability to use sudo without a password
        user: $SSH_USER
        privateKeyRef:
          # This is the name of the secret you created in the previous step. It must exist in the same
          # namespace as this inventory object.
          name: ${SSH_PRIVATE_KEY_SECRET_NAME}
          namespace: default
    ---
    apiVersion: infrastructure.cluster.konvoy.d2iq.io/v1alpha1
    kind: PreprovisionedInventory
    metadata:
      name: ${CLUSTER_NAME}-md-0
      namespace: default
      labels:
        cluster.x-k8s.io/cluster-name: ${CLUSTER_NAME}
        clusterctl.cluster.x-k8s.io/move: ""
    spec:
      hosts:
        - address: ${WORKER_1_ADDRESS}
        - address: ${WORKER_2_ADDRESS}
        - address: ${WORKER_3_ADDRESS}
        - address: ${WORKER_4_ADDRESS}
      sshConfig:
        port: 22
        user: ${SSH_USER}
        privateKeyRef:
          name: ${SSH_PRIVATE_KEY_SECRET_NAME}
          namespace: default
    EOF
  3. To tell the bootstrap cluster which nodes you want to be control plane nodes and which nodes are worker nodes, use the kubectl apply command to apply the file to the bootstrap cluster:

    CODE
    kubectl apply -f preprovisioned_inventory.yaml

    Output:

    CODE
    preprovisionedinventory.infrastructure.cluster.konvoy.d2iq.io/preprovisioned-example-control-plane created
    preprovisionedinventory.infrastructure.cluster.konvoy.d2iq.io/preprovisioned-example-md-0 created

Next Step

Pre-provisioned Cluster Creation Customization Choices

If applicable for a local registry or special Azure considerations, refer to these sections also:

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.