From 4df0348b006be1674d4ca0aae2bc0bc370e0398d Mon Sep 17 00:00:00 2001 From: Caleb Woodbine Date: Thu, 29 Aug 2024 11:08:13 +1200 Subject: [PATCH 1/5] feat: add OCI CAPI adds CAPI for OCI --- terraform/oci-capi-cluster/README.org | 155 +++++++++++++++++ .../oci-capi-cluster/cluster-template.yaml | 156 ++++++++++++++++++ 2 files changed, 311 insertions(+) create mode 100644 terraform/oci-capi-cluster/README.org create mode 100644 terraform/oci-capi-cluster/cluster-template.yaml diff --git a/terraform/oci-capi-cluster/README.org b/terraform/oci-capi-cluster/README.org new file mode 100644 index 0000000..c46ca89 --- /dev/null +++ b/terraform/oci-capi-cluster/README.org @@ -0,0 +1,155 @@ +#+title: OCI CAPI cluster + +Bring up Kubernetes locally + +#+begin_src bash +kind create cluster +#+end_src + +#+begin_src bash :tangle .envrc +[ ! -f priv.env ] || . priv.env +# export OCI_TENANCY_ID= +# export OCI_USER_ID= +# export OCI_CREDENTIALS_FINGERPRINT= +# export OCI_CREDENTIALS_KEY_B64= # $(base64 < path/to/a/key.pem | tr -d '\n') +export OCI_REGION=us-sanjose-1 + +export OCI_TENANCY_ID_B64="$(echo -n "$OCI_TENANCY_ID" | base64 | tr -d '\n')" +export OCI_CREDENTIALS_FINGERPRINT_B64="$(echo -n "$OCI_CREDENTIALS_FINGERPRINT" | base64 | tr -d '\n')" +export OCI_USER_ID_B64="$(echo -n "$OCI_USER_ID" | base64 | tr -d '\n')" +export OCI_REGION_B64="$(echo -n "$OCI_REGION" | base64 | tr -d '\n')" + +# if bootstraping from inside OCI +export USE_INSTANCE_PRINCIPAL="false" +export USE_INSTANCE_PRINCIPAL_B64="$(echo -n "$USE_INSTANCE_PRINCIPAL" | base64 | tr -d '\n')" +#+end_src + +allow env from .envrc + +#+begin_src bash +direnv allow +#+end_src + +bootstrap capi with oci + +#+begin_src bash +clusterctl init -b talos:v0.6.5 -c talos:v0.5.6 --infrastructure oci:v0.16.0 +#+end_src + +create a namespace + +#+begin_src bash +kubectl create ns sharingio +#+end_src + +#+RESULTS: +#+begin_example +namespace/sharingio created +#+end_example + +Generate a cluster config + +#+begin_src bash :tangle .envrc +# export OCI_COMPARTMENT_ID= +# export OCI_IMAGE_ID=ocid1.image.oc1.us-sanjose-1.aaaaaaaazpwpyk7kh6mbu2g6yihups2zf5uwt7moehbafxsu4idaew6nggxq # NOTE Oracle 8 +export OCI_IMAGE_ID=ocid1.image.oc1.us-sanjose-1.aaaaaaaaqemyxu4dnhuapt6dfzuhq6rp5h3f7ld3yqh3crwiu5qtzlk6woma +export OCI_CONTROL_PLANE_MACHINE_TYPE=VM.Standard.A1.Flex +export OCI_CONTROL_PLANE_MACHINE_TYPE_OCPUS=4 +export OCI_NODE_MACHINE_TYPE=VM.Standard.A1.Flex +export OCI_NODE_MACHINE_TYPE_OCPUS=8 +export OCI_SSH_KEY= +export OCI_CONTROL_PLANE_PV_TRANSIT_ENCRYPTION=true +export OCI_NODE_PV_TRANSIT_ENCRYPTION=true + +export TALOS_INSTALL_IMAGE=factory.talos.dev/installer/d01e4eb407f9a242831748cab07de55550fdcfe8be65ce4defd258a93d94562f:v1.7.6 +export CLUSTER_NAME=sharingio +export CONTROL_PLANE_MACHINE_COUNT=3 +export KUBERNETES_VERSION=v1.30.1 +export NAMESPACE=sharingio +export POD_CIDR=192.168.0.0/16 +export SERVICE_CIDR=10.128.0.0/12 +export NODE_MACHINE_COUNT=6 + +#+end_src + +generate a cluster config + +#+begin_src bash +clusterctl -n sharingio generate cluster "$CLUSTER_NAME" --from ./cluster-template.yaml --write-to ./cluster.yaml +#+end_src + +#+RESULTS: +#+begin_example +#+end_example + +apply the cluster + +#+begin_src bash +kubectl -n sharingio apply -f ./cluster.yaml +#+end_src + +#+RESULTS: +#+begin_example +cluster.cluster.x-k8s.io/sharingio created +ocicluster.infrastructure.cluster.x-k8s.io/sharingio created +taloscontrolplane.controlplane.cluster.x-k8s.io/sharingio-control-plane created +ocimachinetemplate.infrastructure.cluster.x-k8s.io/sharingio-control-plane created +ocimachinetemplate.infrastructure.cluster.x-k8s.io/sharingio-md-0 created +talosconfigtemplate.bootstrap.cluster.x-k8s.io/sharingio-md-0 created +machinedeployment.cluster.x-k8s.io/sharingio-md-0 created +#+end_example + +view the world + +#+begin_src shell +kubectl -n sharingio get $(kubectl -n sharingio api-resources | grep x-k8s | awk '{print $1}' | tr '\n' ',' | sed 's/,$//g') +#+end_src + +#+RESULTS: +#+begin_example +NAME AGE +talosconfig.bootstrap.cluster.x-k8s.io/sharingio-md-0-gjmhg-2zps4 50s +talosconfig.bootstrap.cluster.x-k8s.io/sharingio-md-0-gjmhg-8ts94 50s +talosconfig.bootstrap.cluster.x-k8s.io/sharingio-md-0-gjmhg-frc97 50s +talosconfig.bootstrap.cluster.x-k8s.io/sharingio-md-0-gjmhg-j77b6 50s +talosconfig.bootstrap.cluster.x-k8s.io/sharingio-md-0-gjmhg-mbcs8 50s +talosconfig.bootstrap.cluster.x-k8s.io/sharingio-md-0-gjmhg-w847p 50s + +NAME AGE +talosconfigtemplate.bootstrap.cluster.x-k8s.io/sharingio-md-0 85s + +NAME CLUSTERCLASS PHASE AGE VERSION +cluster.cluster.x-k8s.io/sharingio Provisioned 72s + +NAME CLUSTER REPLICAS READY UPDATED UNAVAILABLE PHASE AGE VERSION +machinedeployment.cluster.x-k8s.io/sharingio-md-0 sharingio 6 6 6 ScalingUp 71s v1.30.1 + +NAME CLUSTER NODENAME PROVIDERID PHASE AGE VERSION +machine.cluster.x-k8s.io/sharingio-md-0-gjmhg-2zps4 sharingio Pending 50s v1.30.1 +machine.cluster.x-k8s.io/sharingio-md-0-gjmhg-8ts94 sharingio Pending 50s v1.30.1 +machine.cluster.x-k8s.io/sharingio-md-0-gjmhg-frc97 sharingio Pending 50s v1.30.1 +machine.cluster.x-k8s.io/sharingio-md-0-gjmhg-j77b6 sharingio Pending 50s v1.30.1 +machine.cluster.x-k8s.io/sharingio-md-0-gjmhg-mbcs8 sharingio Pending 50s v1.30.1 +machine.cluster.x-k8s.io/sharingio-md-0-gjmhg-w847p sharingio Pending 50s v1.30.1 + +NAME CLUSTER REPLICAS READY AVAILABLE AGE VERSION +machineset.cluster.x-k8s.io/sharingio-md-0-gjmhg sharingio 6 50s v1.30.1 + +NAME READY INITIALIZED REPLICAS READY REPLICAS UNAVAILABLE REPLICAS +taloscontrolplane.controlplane.cluster.x-k8s.io/sharingio-control-plane + +NAME AGE +ocicluster.infrastructure.cluster.x-k8s.io/sharingio 56s + +NAME AGE +ocimachine.infrastructure.cluster.x-k8s.io/sharingio-md-0-gjmhg-2zps4 50s +ocimachine.infrastructure.cluster.x-k8s.io/sharingio-md-0-gjmhg-8ts94 50s +ocimachine.infrastructure.cluster.x-k8s.io/sharingio-md-0-gjmhg-frc97 50s +ocimachine.infrastructure.cluster.x-k8s.io/sharingio-md-0-gjmhg-j77b6 50s +ocimachine.infrastructure.cluster.x-k8s.io/sharingio-md-0-gjmhg-mbcs8 50s +ocimachine.infrastructure.cluster.x-k8s.io/sharingio-md-0-gjmhg-w847p 50s + +NAME AGE +ocimachinetemplate.infrastructure.cluster.x-k8s.io/sharingio-control-plane 56s +ocimachinetemplate.infrastructure.cluster.x-k8s.io/sharingio-md-0 56s +#+end_example diff --git a/terraform/oci-capi-cluster/cluster-template.yaml b/terraform/oci-capi-cluster/cluster-template.yaml new file mode 100644 index 0000000..6b84d70 --- /dev/null +++ b/terraform/oci-capi-cluster/cluster-template.yaml @@ -0,0 +1,156 @@ +--- +apiVersion: cluster.x-k8s.io/v1beta1 +kind: Cluster +metadata: + labels: + cluster.x-k8s.io/cluster-name: ${CLUSTER_NAME} + name: ${CLUSTER_NAME} + namespace: sharingio +spec: + clusterNetwork: + pods: + cidrBlocks: + - ${POD_CIDR} + serviceDomain: cluster.local + services: + cidrBlocks: + - ${SERVICE_CIDR} + controlPlaneRef: + apiVersion: controlplane.cluster.x-k8s.io/v1alpha3 + kind: TalosControlPlane + name: ${CLUSTER_NAME}-control-plane + namespace: sharingio + infrastructureRef: + apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 + kind: OCICluster + name: ${CLUSTER_NAME} + namespace: sharingio +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 +kind: OCICluster +metadata: + labels: + cluster.x-k8s.io/cluster-name: ${CLUSTER_NAME} + name: ${CLUSTER_NAME} + namespace: sharingio +spec: + compartmentId: ${OCI_COMPARTMENT_ID} +--- +kind: TalosControlPlane +apiVersion: controlplane.cluster.x-k8s.io/v1alpha3 +metadata: + name: "${CLUSTER_NAME}-control-plane" + namespace: sharingio +spec: + version: ${KUBERNETES_VERSION} + replicas: ${CONTROL_PLANE_MACHINE_COUNT} + infrastructureTemplate: + apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 + kind: OCIMachineTemplate + name: "${CLUSTER_NAME}-control-plane" + controlPlaneConfig: + controlplane: + generateType: controlplane + configPatches: + - op: replace + path: /machine/install + value: + disk: /dev/sda + image: ${TALOS_INSTALL_IMAGE} + bootloader: true + wipe: false + - op: add + path: /machine/kubelet/extraArgs + value: + cloud-provider: external + provider-id: oci://{{ ds["id"] }} + - op: add + path: /cluster/apiServer/extraArgs + value: + cloud-provider: external + - op: add + path: /cluster/controllerManager/extraArgs + value: + cloud-provider: external + - op: add + path: /cluster/allowSchedulingOnMasters + value: true + # - op: add + # path: /cluster/extraManifests + # value: [] +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 +kind: OCIMachineTemplate +metadata: + name: ${CLUSTER_NAME}-control-plane + namespace: sharingio +spec: + template: + spec: + compartmentId: ${OCI_COMPARTMENT_ID} + # imageId: ocid1.image.oc1.us-sanjose-1.aaaaaaaazpwpyk7kh6mbu2g6yihups2zf5uwt7moehbafxsu4idaew6nggxq # NOTE Oracle 8 + imageId: ${OCI_IMAGE_ID} + isPvEncryptionInTransitEnabled: ${OCI_CONTROL_PLANE_PV_TRANSIT_ENCRYPTION} + metadata: + ssh_authorized_keys: "" + shape: ${OCI_CONTROL_PLANE_MACHINE_TYPE} + shapeConfig: + ocpus: "${OCI_CONTROL_PLANE_MACHINE_TYPE_OCPUS}" + networkDetails: + assignPublicIp: true +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 +kind: OCIMachineTemplate +metadata: + name: ${CLUSTER_NAME}-md-0 + namespace: sharingio +spec: + template: + spec: + compartmentId: ${OCI_COMPARTMENT_ID} + # imageId: ocid1.image.oc1.us-sanjose-1.aaaaaaaazpwpyk7kh6mbu2g6yihups2zf5uwt7moehbafxsu4idaew6nggxq # NOTE Oracle 8 + imageId: ${OCI_IMAGE_ID} + isPvEncryptionInTransitEnabled: ${OCI_NODE_PV_TRANSIT_ENCRYPTION} + metadata: + ssh_authorized_keys: "" + shape: ${OCI_NODE_MACHINE_TYPE} + shapeConfig: + ocpus: "${OCI_NODE_MACHINE_TYPE_OCPUS}" + networkDetails: + assignPublicIp: true +--- +apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3 +kind: TalosConfigTemplate +metadata: + name: ${CLUSTER_NAME}-md-0 + namespace: sharingio + labels: + cluster.x-k8s.io/cluster-name: ${CLUSTER_NAME} +spec: + template: + spec: + generateType: join +--- +apiVersion: cluster.x-k8s.io/v1beta1 +kind: MachineDeployment +metadata: + name: ${CLUSTER_NAME}-md-0 + namespace: sharingio +spec: + clusterName: ${CLUSTER_NAME} + replicas: ${NODE_MACHINE_COUNT} + selector: + matchLabels: null + template: + spec: + bootstrap: + configRef: + apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3 + kind: TalosConfigTemplate + name: ${CLUSTER_NAME}-md-0 + clusterName: ${CLUSTER_NAME} + infrastructureRef: + apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 + kind: OCIMachineTemplate + name: ${CLUSTER_NAME}-md-0 + version: ${KUBERNETES_VERSION} From eed63129a5c0f869ba61404c5b32464df8e131ab Mon Sep 17 00:00:00 2001 From: Caleb Woodbine Date: Mon, 2 Sep 2024 10:37:17 +1200 Subject: [PATCH 2/5] feat: add public ip to nodes adds a public IP to each controlplane node --- terraform/oci-capi-cluster/README.org | 117 ++++++++---- .../oci-capi-cluster/cluster-template.yaml | 36 +++- terraform/oci-capi-cluster/cluster.yaml | 172 ++++++++++++++++++ terraform/oci-capi-cluster/locals.tf | 5 + terraform/oci-capi-cluster/network.tf | 91 +++++++++ terraform/oci-capi-cluster/output.tf | 7 + terraform/oci-capi-cluster/variables.tf | 66 +++++++ terraform/oci-capi-cluster/versions.tf | 17 ++ 8 files changed, 473 insertions(+), 38 deletions(-) create mode 100644 terraform/oci-capi-cluster/cluster.yaml create mode 100644 terraform/oci-capi-cluster/locals.tf create mode 100644 terraform/oci-capi-cluster/network.tf create mode 100644 terraform/oci-capi-cluster/output.tf create mode 100644 terraform/oci-capi-cluster/variables.tf create mode 100644 terraform/oci-capi-cluster/versions.tf diff --git a/terraform/oci-capi-cluster/README.org b/terraform/oci-capi-cluster/README.org index c46ca89..0786f7a 100644 --- a/terraform/oci-capi-cluster/README.org +++ b/terraform/oci-capi-cluster/README.org @@ -1,5 +1,22 @@ #+title: OCI CAPI cluster +Write a tfvars file + +#+begin_src hcl +tenancy_ocid = "TENANCY OCID" +user_ocid = "YOUR USER OCID" +private_key_path = "YOUR PRIVATE KEY PATH" +fingerprint = "THE FINGERPRINT FOR YOUR PRIVATE KEY" +region = "us-sanjose-1" +compartment_ocid = "YOUR COMPARTMENT OCID" +#+end_src + +Provision network resources + +#+begin_src shell +tofu apply --var-file ./.tfvars +#+end_src + Bring up Kubernetes locally #+begin_src bash @@ -43,9 +60,9 @@ kubectl create ns sharingio #+end_src #+RESULTS: -#+begin_example +#+begin_src bash namespace/sharingio created -#+end_example +#+end_src Generate a cluster config @@ -70,11 +87,13 @@ export POD_CIDR=192.168.0.0/16 export SERVICE_CIDR=10.128.0.0/12 export NODE_MACHINE_COUNT=6 +export OCI_NETWORK_SECURITY_GROUP_ID="$(tofu output --raw oci_network_security_group_id || false)" +export OCI_NETWORK_SUBNET_ID="$(tofu output --raw oci_network_subnet_id)" #+end_src generate a cluster config -#+begin_src bash +#+begin_src bash :epilogue ". .envrc ; \n" clusterctl -n sharingio generate cluster "$CLUSTER_NAME" --from ./cluster-template.yaml --write-to ./cluster.yaml #+end_src @@ -107,49 +126,75 @@ kubectl -n sharingio get $(kubectl -n sharingio api-resources | grep x-k8s | awk #+RESULTS: #+begin_example -NAME AGE -talosconfig.bootstrap.cluster.x-k8s.io/sharingio-md-0-gjmhg-2zps4 50s -talosconfig.bootstrap.cluster.x-k8s.io/sharingio-md-0-gjmhg-8ts94 50s -talosconfig.bootstrap.cluster.x-k8s.io/sharingio-md-0-gjmhg-frc97 50s -talosconfig.bootstrap.cluster.x-k8s.io/sharingio-md-0-gjmhg-j77b6 50s -talosconfig.bootstrap.cluster.x-k8s.io/sharingio-md-0-gjmhg-mbcs8 50s -talosconfig.bootstrap.cluster.x-k8s.io/sharingio-md-0-gjmhg-w847p 50s +NAME AGE +talosconfig.bootstrap.cluster.x-k8s.io/sharingio-control-plane-54xzg 3m59s +talosconfig.bootstrap.cluster.x-k8s.io/sharingio-control-plane-pb4kn 3m59s +talosconfig.bootstrap.cluster.x-k8s.io/sharingio-control-plane-zzqh4 3m59s +talosconfig.bootstrap.cluster.x-k8s.io/sharingio-md-0-hbnp8-89rtk 4m55s +talosconfig.bootstrap.cluster.x-k8s.io/sharingio-md-0-hbnp8-9cj4h 4m55s +talosconfig.bootstrap.cluster.x-k8s.io/sharingio-md-0-hbnp8-cwjqj 4m55s +talosconfig.bootstrap.cluster.x-k8s.io/sharingio-md-0-hbnp8-k2q95 4m55s +talosconfig.bootstrap.cluster.x-k8s.io/sharingio-md-0-hbnp8-pwcpr 4m55s +talosconfig.bootstrap.cluster.x-k8s.io/sharingio-md-0-hbnp8-tf5sz 4m55s NAME AGE -talosconfigtemplate.bootstrap.cluster.x-k8s.io/sharingio-md-0 85s +talosconfigtemplate.bootstrap.cluster.x-k8s.io/sharingio-md-0 4m55s -NAME CLUSTERCLASS PHASE AGE VERSION -cluster.cluster.x-k8s.io/sharingio Provisioned 72s +NAME CLUSTERCLASS PHASE AGE VERSION +cluster.cluster.x-k8s.io/sharingio Provisioned 4m56s -NAME CLUSTER REPLICAS READY UPDATED UNAVAILABLE PHASE AGE VERSION -machinedeployment.cluster.x-k8s.io/sharingio-md-0 sharingio 6 6 6 ScalingUp 71s v1.30.1 +NAME CLUSTER REPLICAS READY UPDATED UNAVAILABLE PHASE AGE VERSION +machinedeployment.cluster.x-k8s.io/sharingio-md-0 sharingio 6 6 6 ScalingUp 4m55s v1.30.1 -NAME CLUSTER NODENAME PROVIDERID PHASE AGE VERSION -machine.cluster.x-k8s.io/sharingio-md-0-gjmhg-2zps4 sharingio Pending 50s v1.30.1 -machine.cluster.x-k8s.io/sharingio-md-0-gjmhg-8ts94 sharingio Pending 50s v1.30.1 -machine.cluster.x-k8s.io/sharingio-md-0-gjmhg-frc97 sharingio Pending 50s v1.30.1 -machine.cluster.x-k8s.io/sharingio-md-0-gjmhg-j77b6 sharingio Pending 50s v1.30.1 -machine.cluster.x-k8s.io/sharingio-md-0-gjmhg-mbcs8 sharingio Pending 50s v1.30.1 -machine.cluster.x-k8s.io/sharingio-md-0-gjmhg-w847p sharingio Pending 50s v1.30.1 +NAME CLUSTER NODENAME PROVIDERID PHASE AGE VERSION +machine.cluster.x-k8s.io/sharingio-control-plane-49xdq sharingio oci://ocid1.instance.oc1.us-sanjose-1.anzwuljr2lro64icvam6pkgfs2qtfkrtvwxubduivaq5lsx7s3wemcukihwq Provisioned 3m59s v1.30.1 +machine.cluster.x-k8s.io/sharingio-control-plane-7vhcm sharingio oci://ocid1.instance.oc1.us-sanjose-1.anzwuljr2lro64icfmmfof6cpvas5pb6qnyz5pwc2afk4p3vnuxouwxwrmqa Provisioned 3m59s v1.30.1 +machine.cluster.x-k8s.io/sharingio-control-plane-sdd4h sharingio oci://ocid1.instance.oc1.us-sanjose-1.anzwuljr2lro64iccmt7zj6sbj3ov7nmsi53demqdybwn7hp57gcohpokyuq Provisioned 3m59s v1.30.1 +machine.cluster.x-k8s.io/sharingio-md-0-hbnp8-89rtk sharingio Pending 4m55s v1.30.1 +machine.cluster.x-k8s.io/sharingio-md-0-hbnp8-9cj4h sharingio Pending 4m55s v1.30.1 +machine.cluster.x-k8s.io/sharingio-md-0-hbnp8-cwjqj sharingio Pending 4m55s v1.30.1 +machine.cluster.x-k8s.io/sharingio-md-0-hbnp8-k2q95 sharingio Pending 4m55s v1.30.1 +machine.cluster.x-k8s.io/sharingio-md-0-hbnp8-pwcpr sharingio Pending 4m55s v1.30.1 +machine.cluster.x-k8s.io/sharingio-md-0-hbnp8-tf5sz sharingio Pending 4m55s v1.30.1 -NAME CLUSTER REPLICAS READY AVAILABLE AGE VERSION -machineset.cluster.x-k8s.io/sharingio-md-0-gjmhg sharingio 6 50s v1.30.1 +NAME CLUSTER REPLICAS READY AVAILABLE AGE VERSION +machineset.cluster.x-k8s.io/sharingio-md-0-hbnp8 sharingio 6 4m55s v1.30.1 NAME READY INITIALIZED REPLICAS READY REPLICAS UNAVAILABLE REPLICAS -taloscontrolplane.controlplane.cluster.x-k8s.io/sharingio-control-plane +taloscontrolplane.controlplane.cluster.x-k8s.io/sharingio-control-plane 3 3 NAME AGE -ocicluster.infrastructure.cluster.x-k8s.io/sharingio 56s - -NAME AGE -ocimachine.infrastructure.cluster.x-k8s.io/sharingio-md-0-gjmhg-2zps4 50s -ocimachine.infrastructure.cluster.x-k8s.io/sharingio-md-0-gjmhg-8ts94 50s -ocimachine.infrastructure.cluster.x-k8s.io/sharingio-md-0-gjmhg-frc97 50s -ocimachine.infrastructure.cluster.x-k8s.io/sharingio-md-0-gjmhg-j77b6 50s -ocimachine.infrastructure.cluster.x-k8s.io/sharingio-md-0-gjmhg-mbcs8 50s -ocimachine.infrastructure.cluster.x-k8s.io/sharingio-md-0-gjmhg-w847p 50s +ocicluster.infrastructure.cluster.x-k8s.io/sharingio 4m56s + +NAME AGE +ocimachine.infrastructure.cluster.x-k8s.io/sharingio-control-plane-95b4h 3m59s +ocimachine.infrastructure.cluster.x-k8s.io/sharingio-control-plane-968kw 3m59s +ocimachine.infrastructure.cluster.x-k8s.io/sharingio-control-plane-fjxgw 3m59s +ocimachine.infrastructure.cluster.x-k8s.io/sharingio-md-0-hbnp8-89rtk 4m55s +ocimachine.infrastructure.cluster.x-k8s.io/sharingio-md-0-hbnp8-9cj4h 4m55s +ocimachine.infrastructure.cluster.x-k8s.io/sharingio-md-0-hbnp8-cwjqj 4m55s +ocimachine.infrastructure.cluster.x-k8s.io/sharingio-md-0-hbnp8-k2q95 4m55s +ocimachine.infrastructure.cluster.x-k8s.io/sharingio-md-0-hbnp8-pwcpr 4m55s +ocimachine.infrastructure.cluster.x-k8s.io/sharingio-md-0-hbnp8-tf5sz 4m55s NAME AGE -ocimachinetemplate.infrastructure.cluster.x-k8s.io/sharingio-control-plane 56s -ocimachinetemplate.infrastructure.cluster.x-k8s.io/sharingio-md-0 56s +ocimachinetemplate.infrastructure.cluster.x-k8s.io/sharingio-control-plane 4m56s +ocimachinetemplate.infrastructure.cluster.x-k8s.io/sharingio-md-0 4m55s +#+end_example + +Tear down + +#+begin_src shell +kubectl -n sharingio delete -f ./cluster.yaml 2>&1 +#+end_src + +#+RESULTS: +#+begin_example +Error from server (NotFound): error when deleting "./cluster.yaml": clusters.cluster.x-k8s.io "sharingio" not found +Error from server (NotFound): error when deleting "./cluster.yaml": ociclusters.infrastructure.cluster.x-k8s.io "sharingio" not found +Error from server (NotFound): error when deleting "./cluster.yaml": taloscontrolplanes.controlplane.cluster.x-k8s.io "sharingio-control-plane" not found +Error from server (NotFound): error when deleting "./cluster.yaml": ocimachinetemplates.infrastructure.cluster.x-k8s.io "sharingio-control-plane" not found +Error from server (NotFound): error when deleting "./cluster.yaml": ocimachinetemplates.infrastructure.cluster.x-k8s.io "sharingio-md-0" not found +Error from server (NotFound): error when deleting "./cluster.yaml": talosconfigtemplates.bootstrap.cluster.x-k8s.io "sharingio-md-0" not found +Error from server (NotFound): error when deleting "./cluster.yaml": machinedeployments.cluster.x-k8s.io "sharingio-md-0" not found #+end_example diff --git a/terraform/oci-capi-cluster/cluster-template.yaml b/terraform/oci-capi-cluster/cluster-template.yaml index 6b84d70..0c849c2 100644 --- a/terraform/oci-capi-cluster/cluster-template.yaml +++ b/terraform/oci-capi-cluster/cluster-template.yaml @@ -41,6 +41,8 @@ apiVersion: controlplane.cluster.x-k8s.io/v1alpha3 metadata: name: "${CLUSTER_NAME}-control-plane" namespace: sharingio + labels: + cluster.x-k8s.io/cluster-name: ${CLUSTER_NAME} spec: version: ${KUBERNETES_VERSION} replicas: ${CONTROL_PLANE_MACHINE_COUNT} @@ -84,6 +86,8 @@ kind: OCIMachineTemplate metadata: name: ${CLUSTER_NAME}-control-plane namespace: sharingio + labels: + cluster.x-k8s.io/cluster-name: ${CLUSTER_NAME} spec: template: spec: @@ -98,12 +102,17 @@ spec: ocpus: "${OCI_CONTROL_PLANE_MACHINE_TYPE_OCPUS}" networkDetails: assignPublicIp: true + nsgIds: + - ${OCI_NETWORK_SECURITY_GROUP_ID} + subnetId: ${OCI_NETWORK_SUBNET_ID} --- apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: OCIMachineTemplate metadata: name: ${CLUSTER_NAME}-md-0 namespace: sharingio + labels: + cluster.x-k8s.io/cluster-name: ${CLUSTER_NAME} spec: template: spec: @@ -116,8 +125,8 @@ spec: shape: ${OCI_NODE_MACHINE_TYPE} shapeConfig: ocpus: "${OCI_NODE_MACHINE_TYPE_OCPUS}" - networkDetails: - assignPublicIp: true + # networkDetails: + # assignPublicIp: true --- apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3 kind: TalosConfigTemplate @@ -130,12 +139,35 @@ spec: template: spec: generateType: join + configPatches: + - op: replace + path: /machine/install + value: + disk: /dev/sda + image: ${TALOS_INSTALL_IMAGE} + bootloader: true + wipe: false + - op: add + path: /machine/kubelet/extraArgs + value: + cloud-provider: external + provider-id: oci://{{ ds["id"] }} + - op: add + path: /cluster/apiServer/extraArgs + value: + cloud-provider: external + - op: add + path: /cluster/controllerManager/extraArgs + value: + cloud-provider: external --- apiVersion: cluster.x-k8s.io/v1beta1 kind: MachineDeployment metadata: name: ${CLUSTER_NAME}-md-0 namespace: sharingio + labels: + cluster.x-k8s.io/cluster-name: ${CLUSTER_NAME} spec: clusterName: ${CLUSTER_NAME} replicas: ${NODE_MACHINE_COUNT} diff --git a/terraform/oci-capi-cluster/cluster.yaml b/terraform/oci-capi-cluster/cluster.yaml new file mode 100644 index 0000000..1621bb6 --- /dev/null +++ b/terraform/oci-capi-cluster/cluster.yaml @@ -0,0 +1,172 @@ +apiVersion: cluster.x-k8s.io/v1beta1 +kind: Cluster +metadata: + labels: + cluster.x-k8s.io/cluster-name: sharingio + name: sharingio + namespace: sharingio +spec: + clusterNetwork: + pods: + cidrBlocks: + - 192.168.0.0/16 + serviceDomain: cluster.local + services: + cidrBlocks: + - 10.128.0.0/12 + controlPlaneRef: + apiVersion: controlplane.cluster.x-k8s.io/v1alpha3 + kind: TalosControlPlane + name: sharingio-control-plane + namespace: sharingio + infrastructureRef: + apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 + kind: OCICluster + name: sharingio + namespace: sharingio +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 +kind: OCICluster +metadata: + labels: + cluster.x-k8s.io/cluster-name: sharingio + name: sharingio + namespace: sharingio +spec: + compartmentId: ocid1.compartment.oc1..aaaaaaaac5nbffbezgxubg53nem624gylmjihujtw4ypafwoxp3mvrmcu5ba +--- +apiVersion: controlplane.cluster.x-k8s.io/v1alpha3 +kind: TalosControlPlane +metadata: + name: sharingio-control-plane + namespace: sharingio +spec: + controlPlaneConfig: + controlplane: + configPatches: + - op: replace + path: /machine/install + value: + bootloader: true + disk: /dev/sda + image: factory.talos.dev/installer/d01e4eb407f9a242831748cab07de55550fdcfe8be65ce4defd258a93d94562f:v1.7.6 + wipe: false + - op: add + path: /machine/kubelet/extraArgs + value: + cloud-provider: external + provider-id: oci://{{ ds["id"] }} + - op: add + path: /cluster/apiServer/extraArgs + value: + cloud-provider: external + - op: add + path: /cluster/controllerManager/extraArgs + value: + cloud-provider: external + - op: add + path: /cluster/allowSchedulingOnMasters + value: true + generateType: controlplane + infrastructureTemplate: + apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 + kind: OCIMachineTemplate + name: sharingio-control-plane + replicas: 3 + version: v1.30.1 +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 +kind: OCIMachineTemplate +metadata: + name: sharingio-control-plane + namespace: sharingio +spec: + template: + spec: + compartmentId: ocid1.compartment.oc1..aaaaaaaac5nbffbezgxubg53nem624gylmjihujtw4ypafwoxp3mvrmcu5ba + imageId: ocid1.image.oc1.us-sanjose-1.aaaaaaaaqemyxu4dnhuapt6dfzuhq6rp5h3f7ld3yqh3crwiu5qtzlk6woma + isPvEncryptionInTransitEnabled: true + metadata: + ssh_authorized_keys: "" + networkDetails: + assignPublicIp: true + nsgIds: + - ocid1.networksecuritygroup.oc1.us-sanjose-1.aaaaaaaagzhulfmzkzmcdc5hr33wfvpqmxeq2bgjs5inchmzoi6s7vhzlvjq + subnetId: ocid1.subnet.oc1.us-sanjose-1.aaaaaaaan27lv43bzsga256p2im3iuwf5ktlbu7u56tmv4rb7zzuna3c5oaq + shape: VM.Standard.A1.Flex + shapeConfig: + ocpus: "4" +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 +kind: OCIMachineTemplate +metadata: + name: sharingio-md-0 + namespace: sharingio +spec: + template: + spec: + compartmentId: ocid1.compartment.oc1..aaaaaaaac5nbffbezgxubg53nem624gylmjihujtw4ypafwoxp3mvrmcu5ba + imageId: ocid1.image.oc1.us-sanjose-1.aaaaaaaaqemyxu4dnhuapt6dfzuhq6rp5h3f7ld3yqh3crwiu5qtzlk6woma + isPvEncryptionInTransitEnabled: true + metadata: + ssh_authorized_keys: "" + shape: VM.Standard.A1.Flex + shapeConfig: + ocpus: "8" +--- +apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3 +kind: TalosConfigTemplate +metadata: + labels: + cluster.x-k8s.io/cluster-name: sharingio + name: sharingio-md-0 + namespace: sharingio +spec: + template: + spec: + configPatches: + - op: replace + path: /machine/install + value: + bootloader: true + disk: /dev/sda + image: factory.talos.dev/installer/d01e4eb407f9a242831748cab07de55550fdcfe8be65ce4defd258a93d94562f:v1.7.6 + wipe: false + - op: add + path: /machine/kubelet/extraArgs + value: + cloud-provider: external + provider-id: oci://{{ ds["id"] }} + - op: add + path: /cluster/apiServer/extraArgs + value: + cloud-provider: external + - op: add + path: /cluster/controllerManager/extraArgs + value: + cloud-provider: external + generateType: join +--- +apiVersion: cluster.x-k8s.io/v1beta1 +kind: MachineDeployment +metadata: + name: sharingio-md-0 + namespace: sharingio +spec: + clusterName: sharingio + replicas: 6 + selector: + matchLabels: null + template: + spec: + bootstrap: + configRef: + apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3 + kind: TalosConfigTemplate + name: sharingio-md-0 + clusterName: sharingio + infrastructureRef: + apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 + kind: OCIMachineTemplate + name: sharingio-md-0 + version: v1.30.1 diff --git a/terraform/oci-capi-cluster/locals.tf b/terraform/oci-capi-cluster/locals.tf new file mode 100644 index 0000000..7e7373c --- /dev/null +++ b/terraform/oci-capi-cluster/locals.tf @@ -0,0 +1,5 @@ +locals { + common_labels = { + "TalosCluster" = var.cluster_name + } +} diff --git a/terraform/oci-capi-cluster/network.tf b/terraform/oci-capi-cluster/network.tf new file mode 100644 index 0000000..9492d45 --- /dev/null +++ b/terraform/oci-capi-cluster/network.tf @@ -0,0 +1,91 @@ +resource "oci_core_vcn" "vcn" { + #Required + compartment_id = var.compartment_ocid + + #Optional + cidr_blocks = var.cidr_blocks + display_name = "${var.cluster_name}-vcn" + freeform_tags = local.common_labels + is_ipv6enabled = true +} +resource "oci_core_subnet" "subnet" { + #Required + cidr_block = var.subnet_block + compartment_id = var.compartment_ocid + vcn_id = oci_core_vcn.vcn.id + prohibit_internet_ingress = false + prohibit_public_ip_on_vnic = false + + #Optional + display_name = "${var.cluster_name}-subnet" + freeform_tags = local.common_labels + security_list_ids = [oci_core_security_list.security_list.id] + route_table_id = oci_core_route_table.route_table.id +} +resource "oci_core_network_security_group" "network_security_group" { + #Required + compartment_id = var.compartment_ocid + vcn_id = oci_core_vcn.vcn.id + + #Optional + display_name = "${var.cluster_name}-security-group" + freeform_tags = local.common_labels +} +resource "oci_core_network_security_group_security_rule" "allow_all" { + network_security_group_id = oci_core_network_security_group.network_security_group.id + destination_type = "CIDR_BLOCK" + destination = "0.0.0.0/0" + protocol = "all" + direction = "EGRESS" + stateless = false +} +resource "oci_core_route_table" "route_table" { + #Required + compartment_id = var.compartment_ocid + vcn_id = oci_core_vcn.vcn.id + + #Optional + display_name = "${var.cluster_name}-route-table" + freeform_tags = local.common_labels + route_rules { + #Required + network_entity_id = oci_core_internet_gateway.internet_gateway.id + + #Optional + destination_type = "CIDR_BLOCK" + destination = "0.0.0.0/0" + } +} +resource "oci_core_security_list" "security_list" { + #Required + compartment_id = var.compartment_ocid + vcn_id = oci_core_vcn.vcn.id + + #Optional + display_name = "${var.cluster_name}-security-list" + egress_security_rules { + #Required + destination = "0.0.0.0/0" + protocol = "all" + + stateless = true + } + freeform_tags = local.common_labels + ingress_security_rules { + #Required + source = "0.0.0.0/0" + protocol = "all" + + stateless = true + } +} +resource "oci_core_internet_gateway" "internet_gateway" { + #Required + compartment_id = var.compartment_ocid + vcn_id = oci_core_vcn.vcn.id + + #Optional + enabled = true + display_name = "${var.cluster_name}-internet-gateway" + freeform_tags = local.common_labels +} diff --git a/terraform/oci-capi-cluster/output.tf b/terraform/oci-capi-cluster/output.tf new file mode 100644 index 0000000..c1f41fe --- /dev/null +++ b/terraform/oci-capi-cluster/output.tf @@ -0,0 +1,7 @@ +output "oci_network_security_group_id" { + value = oci_core_network_security_group.network_security_group.id +} + +output "oci_network_subnet_id" { + value = oci_core_subnet.subnet.id +} diff --git a/terraform/oci-capi-cluster/variables.tf b/terraform/oci-capi-cluster/variables.tf new file mode 100644 index 0000000..9aa482f --- /dev/null +++ b/terraform/oci-capi-cluster/variables.tf @@ -0,0 +1,66 @@ +variable "compartment_ocid" { + sensitive = true +} +variable "tenancy_ocid" { + sensitive = true +} +variable "user_ocid" { + sensitive = true +} +variable "fingerprint" { + sensitive = true +} +variable "private_key_path" { + default = "~/.oci/oci_main_terraform.pem" + sensitive = true +} +variable "instance_availability_domain" { + default = null +} +variable "region" { + description = "the OCI region where resources will be created" + type = string + default = null +} +variable "cluster_name" { + type = string + default = "cncfocicapi" +} +variable "cidr_blocks" { + type = set(string) + default = ["10.0.0.0/16"] +} +variable "subnet_block" { + type = string + default = "10.0.0.0/24" +} +variable "talos_version" { + type = string + default = "v1.7.6" +} +variable "kubernetes_version" { + type = string + default = "v1.30.3" +} +variable "instance_shape" { + default = "VM.Standard.A1.Flex" +} +variable "oracle_cloud_ccm_version" { + default = "v1.29.0" +} +variable "talos_ccm_version" { + type = string + default = "v1.6.0" +} +variable "pod_subnet_block" { + type = string + default = "10.32.0.0/12" +} +variable "service_subnet_block" { + type = string + default = "10.200.0.0/22" +} +variable "node_subnet_block" { + type = string + default = "192.168.0.0/16" +} diff --git a/terraform/oci-capi-cluster/versions.tf b/terraform/oci-capi-cluster/versions.tf new file mode 100644 index 0000000..c056b79 --- /dev/null +++ b/terraform/oci-capi-cluster/versions.tf @@ -0,0 +1,17 @@ +terraform { + required_providers { + oci = { + source = "oracle/oci" + version = "6.7.0" # TODO include version in project root providers + } + } + required_version = ">= 1.2" +} + +provider "oci" { + tenancy_ocid = var.tenancy_ocid + user_ocid = var.user_ocid + private_key_path = var.private_key_path + fingerprint = var.fingerprint + region = var.region +} From 9646e67eedd87b323b6c774042a9bb336a432677 Mon Sep 17 00:00:00 2001 From: Caleb Woodbine Date: Mon, 2 Sep 2024 11:47:02 +1200 Subject: [PATCH 3/5] chore: update docs, cluster config --- terraform/oci-capi-cluster/README.org | 178 +++++++++++------- .../oci-capi-cluster/cluster-template.yaml | 17 +- terraform/oci-capi-cluster/cluster.yaml | 172 ----------------- 3 files changed, 120 insertions(+), 247 deletions(-) delete mode 100644 terraform/oci-capi-cluster/cluster.yaml diff --git a/terraform/oci-capi-cluster/README.org b/terraform/oci-capi-cluster/README.org index 0786f7a..cbea3a9 100644 --- a/terraform/oci-capi-cluster/README.org +++ b/terraform/oci-capi-cluster/README.org @@ -23,6 +23,8 @@ Bring up Kubernetes locally kind create cluster #+end_src +Define env + #+begin_src bash :tangle .envrc [ ! -f priv.env ] || . priv.env # export OCI_TENANCY_ID= @@ -50,7 +52,7 @@ direnv allow bootstrap capi with oci #+begin_src bash -clusterctl init -b talos:v0.6.5 -c talos:v0.5.6 --infrastructure oci:v0.16.0 +clusterctl init --bootstrap talos:v0.6.5 --control-plane talos:v0.5.6 --infrastructure oci:v0.16.0 #+end_src create a namespace @@ -60,11 +62,11 @@ kubectl create ns sharingio #+end_src #+RESULTS: -#+begin_src bash +#+begin_example namespace/sharingio created -#+end_src +#+end_example -Generate a cluster config +Define more env #+begin_src bash :tangle .envrc # export OCI_COMPARTMENT_ID= @@ -79,13 +81,14 @@ export OCI_CONTROL_PLANE_PV_TRANSIT_ENCRYPTION=true export OCI_NODE_PV_TRANSIT_ENCRYPTION=true export TALOS_INSTALL_IMAGE=factory.talos.dev/installer/d01e4eb407f9a242831748cab07de55550fdcfe8be65ce4defd258a93d94562f:v1.7.6 -export CLUSTER_NAME=sharingio +export CLUSTER_NAME=cncfocicapi export CONTROL_PLANE_MACHINE_COUNT=3 export KUBERNETES_VERSION=v1.30.1 export NAMESPACE=sharingio export POD_CIDR=192.168.0.0/16 export SERVICE_CIDR=10.128.0.0/12 export NODE_MACHINE_COUNT=6 +export OCI_NETWORK_SUBNET_NAME="${CLUSTER_NAME}-subnet" export OCI_NETWORK_SECURITY_GROUP_ID="$(tofu output --raw oci_network_security_group_id || false)" export OCI_NETWORK_SUBNET_ID="$(tofu output --raw oci_network_subnet_id)" @@ -104,18 +107,18 @@ clusterctl -n sharingio generate cluster "$CLUSTER_NAME" --from ./cluster-templa apply the cluster #+begin_src bash -kubectl -n sharingio apply -f ./cluster.yaml +kubectl -n sharingio apply -f ./cluster.yaml 2>&1 #+end_src #+RESULTS: #+begin_example -cluster.cluster.x-k8s.io/sharingio created -ocicluster.infrastructure.cluster.x-k8s.io/sharingio created -taloscontrolplane.controlplane.cluster.x-k8s.io/sharingio-control-plane created -ocimachinetemplate.infrastructure.cluster.x-k8s.io/sharingio-control-plane created -ocimachinetemplate.infrastructure.cluster.x-k8s.io/sharingio-md-0 created -talosconfigtemplate.bootstrap.cluster.x-k8s.io/sharingio-md-0 created -machinedeployment.cluster.x-k8s.io/sharingio-md-0 created +cluster.cluster.x-k8s.io/cncfocicapi created +ocicluster.infrastructure.cluster.x-k8s.io/cncfocicapi created +taloscontrolplane.controlplane.cluster.x-k8s.io/cncfocicapi-control-plane created +ocimachinetemplate.infrastructure.cluster.x-k8s.io/cncfocicapi-control-plane created +ocimachinetemplate.infrastructure.cluster.x-k8s.io/cncfocicapi-md-0 created +talosconfigtemplate.bootstrap.cluster.x-k8s.io/cncfocicapi-md-0 created +machinedeployment.cluster.x-k8s.io/cncfocicapi-md-0 created #+end_example view the world @@ -126,60 +129,91 @@ kubectl -n sharingio get $(kubectl -n sharingio api-resources | grep x-k8s | awk #+RESULTS: #+begin_example -NAME AGE -talosconfig.bootstrap.cluster.x-k8s.io/sharingio-control-plane-54xzg 3m59s -talosconfig.bootstrap.cluster.x-k8s.io/sharingio-control-plane-pb4kn 3m59s -talosconfig.bootstrap.cluster.x-k8s.io/sharingio-control-plane-zzqh4 3m59s -talosconfig.bootstrap.cluster.x-k8s.io/sharingio-md-0-hbnp8-89rtk 4m55s -talosconfig.bootstrap.cluster.x-k8s.io/sharingio-md-0-hbnp8-9cj4h 4m55s -talosconfig.bootstrap.cluster.x-k8s.io/sharingio-md-0-hbnp8-cwjqj 4m55s -talosconfig.bootstrap.cluster.x-k8s.io/sharingio-md-0-hbnp8-k2q95 4m55s -talosconfig.bootstrap.cluster.x-k8s.io/sharingio-md-0-hbnp8-pwcpr 4m55s -talosconfig.bootstrap.cluster.x-k8s.io/sharingio-md-0-hbnp8-tf5sz 4m55s - -NAME AGE -talosconfigtemplate.bootstrap.cluster.x-k8s.io/sharingio-md-0 4m55s - -NAME CLUSTERCLASS PHASE AGE VERSION -cluster.cluster.x-k8s.io/sharingio Provisioned 4m56s - -NAME CLUSTER REPLICAS READY UPDATED UNAVAILABLE PHASE AGE VERSION -machinedeployment.cluster.x-k8s.io/sharingio-md-0 sharingio 6 6 6 ScalingUp 4m55s v1.30.1 - -NAME CLUSTER NODENAME PROVIDERID PHASE AGE VERSION -machine.cluster.x-k8s.io/sharingio-control-plane-49xdq sharingio oci://ocid1.instance.oc1.us-sanjose-1.anzwuljr2lro64icvam6pkgfs2qtfkrtvwxubduivaq5lsx7s3wemcukihwq Provisioned 3m59s v1.30.1 -machine.cluster.x-k8s.io/sharingio-control-plane-7vhcm sharingio oci://ocid1.instance.oc1.us-sanjose-1.anzwuljr2lro64icfmmfof6cpvas5pb6qnyz5pwc2afk4p3vnuxouwxwrmqa Provisioned 3m59s v1.30.1 -machine.cluster.x-k8s.io/sharingio-control-plane-sdd4h sharingio oci://ocid1.instance.oc1.us-sanjose-1.anzwuljr2lro64iccmt7zj6sbj3ov7nmsi53demqdybwn7hp57gcohpokyuq Provisioned 3m59s v1.30.1 -machine.cluster.x-k8s.io/sharingio-md-0-hbnp8-89rtk sharingio Pending 4m55s v1.30.1 -machine.cluster.x-k8s.io/sharingio-md-0-hbnp8-9cj4h sharingio Pending 4m55s v1.30.1 -machine.cluster.x-k8s.io/sharingio-md-0-hbnp8-cwjqj sharingio Pending 4m55s v1.30.1 -machine.cluster.x-k8s.io/sharingio-md-0-hbnp8-k2q95 sharingio Pending 4m55s v1.30.1 -machine.cluster.x-k8s.io/sharingio-md-0-hbnp8-pwcpr sharingio Pending 4m55s v1.30.1 -machine.cluster.x-k8s.io/sharingio-md-0-hbnp8-tf5sz sharingio Pending 4m55s v1.30.1 - -NAME CLUSTER REPLICAS READY AVAILABLE AGE VERSION -machineset.cluster.x-k8s.io/sharingio-md-0-hbnp8 sharingio 6 4m55s v1.30.1 - -NAME READY INITIALIZED REPLICAS READY REPLICAS UNAVAILABLE REPLICAS -taloscontrolplane.controlplane.cluster.x-k8s.io/sharingio-control-plane 3 3 - -NAME AGE -ocicluster.infrastructure.cluster.x-k8s.io/sharingio 4m56s - -NAME AGE -ocimachine.infrastructure.cluster.x-k8s.io/sharingio-control-plane-95b4h 3m59s -ocimachine.infrastructure.cluster.x-k8s.io/sharingio-control-plane-968kw 3m59s -ocimachine.infrastructure.cluster.x-k8s.io/sharingio-control-plane-fjxgw 3m59s -ocimachine.infrastructure.cluster.x-k8s.io/sharingio-md-0-hbnp8-89rtk 4m55s -ocimachine.infrastructure.cluster.x-k8s.io/sharingio-md-0-hbnp8-9cj4h 4m55s -ocimachine.infrastructure.cluster.x-k8s.io/sharingio-md-0-hbnp8-cwjqj 4m55s -ocimachine.infrastructure.cluster.x-k8s.io/sharingio-md-0-hbnp8-k2q95 4m55s -ocimachine.infrastructure.cluster.x-k8s.io/sharingio-md-0-hbnp8-pwcpr 4m55s -ocimachine.infrastructure.cluster.x-k8s.io/sharingio-md-0-hbnp8-tf5sz 4m55s +NAME AGE +talosconfig.bootstrap.cluster.x-k8s.io/cncfocicapi-control-plane-9798j 5m32s +talosconfig.bootstrap.cluster.x-k8s.io/cncfocicapi-control-plane-fkrbr 5m33s +talosconfig.bootstrap.cluster.x-k8s.io/cncfocicapi-control-plane-tjv2n 5m32s +talosconfig.bootstrap.cluster.x-k8s.io/cncfocicapi-md-0-hd9wn-6pk7x 6m56s +talosconfig.bootstrap.cluster.x-k8s.io/cncfocicapi-md-0-hd9wn-fb8zn 6m57s +talosconfig.bootstrap.cluster.x-k8s.io/cncfocicapi-md-0-hd9wn-gvn2c 6m56s +talosconfig.bootstrap.cluster.x-k8s.io/cncfocicapi-md-0-hd9wn-h2kv2 6m56s +talosconfig.bootstrap.cluster.x-k8s.io/cncfocicapi-md-0-hd9wn-r5cws 6m56s +talosconfig.bootstrap.cluster.x-k8s.io/cncfocicapi-md-0-hd9wn-vlhqc 6m56s +talosconfig.bootstrap.cluster.x-k8s.io/sharingio-control-plane-c7qpb 26m +talosconfig.bootstrap.cluster.x-k8s.io/sharingio-control-plane-z7j4r 26m +talosconfig.bootstrap.cluster.x-k8s.io/sharingio-control-plane-zj9g5 26m + +NAME AGE +talosconfigtemplate.bootstrap.cluster.x-k8s.io/cncfocicapi-md-0 6m57s + +NAME CLUSTERCLASS PHASE AGE VERSION +cluster.cluster.x-k8s.io/cncfocicapi Provisioned 6m57s +cluster.cluster.x-k8s.io/sharingio Deleting 27m + +NAME CLUSTER REPLICAS READY UPDATED UNAVAILABLE PHASE AGE VERSION +machinedeployment.cluster.x-k8s.io/cncfocicapi-md-0 cncfocicapi 6 6 6 ScalingUp 6m57s v1.30.1 + +NAME CLUSTER NODENAME PROVIDERID PHASE AGE VERSION +machine.cluster.x-k8s.io/cncfocicapi-control-plane-phr6z cncfocicapi Provisioning 5m32s v1.30.1 +machine.cluster.x-k8s.io/cncfocicapi-control-plane-qq5zq cncfocicapi Provisioning 5m32s v1.30.1 +machine.cluster.x-k8s.io/cncfocicapi-control-plane-rg2xt cncfocicapi Provisioning 5m32s v1.30.1 +machine.cluster.x-k8s.io/cncfocicapi-md-0-hd9wn-6pk7x cncfocicapi Pending 6m56s v1.30.1 +machine.cluster.x-k8s.io/cncfocicapi-md-0-hd9wn-fb8zn cncfocicapi Pending 6m56s v1.30.1 +machine.cluster.x-k8s.io/cncfocicapi-md-0-hd9wn-gvn2c cncfocicapi Pending 6m56s v1.30.1 +machine.cluster.x-k8s.io/cncfocicapi-md-0-hd9wn-h2kv2 cncfocicapi Pending 6m56s v1.30.1 +machine.cluster.x-k8s.io/cncfocicapi-md-0-hd9wn-r5cws cncfocicapi Pending 6m56s v1.30.1 +machine.cluster.x-k8s.io/cncfocicapi-md-0-hd9wn-vlhqc cncfocicapi Pending 6m56s v1.30.1 +machine.cluster.x-k8s.io/sharingio-control-plane-6kn5v sharingio Deleting 26m v1.30.1 +machine.cluster.x-k8s.io/sharingio-control-plane-8ntmx sharingio Deleting 26m v1.30.1 +machine.cluster.x-k8s.io/sharingio-control-plane-bfv5k sharingio Deleting 26m v1.30.1 + +NAME CLUSTER REPLICAS READY AVAILABLE AGE VERSION +machineset.cluster.x-k8s.io/cncfocicapi-md-0-hd9wn cncfocicapi 6 6m57s v1.30.1 + +NAME READY INITIALIZED REPLICAS READY REPLICAS UNAVAILABLE REPLICAS +taloscontrolplane.controlplane.cluster.x-k8s.io/cncfocicapi-control-plane 3 3 +taloscontrolplane.controlplane.cluster.x-k8s.io/sharingio-control-plane 3 3 + +NAME AGE +ocicluster.infrastructure.cluster.x-k8s.io/cncfocicapi 6m57s NAME AGE -ocimachinetemplate.infrastructure.cluster.x-k8s.io/sharingio-control-plane 4m56s -ocimachinetemplate.infrastructure.cluster.x-k8s.io/sharingio-md-0 4m55s +ocimachine.infrastructure.cluster.x-k8s.io/cncfocicapi-control-plane-5m2ln 5m33s +ocimachine.infrastructure.cluster.x-k8s.io/cncfocicapi-control-plane-phxbg 5m32s +ocimachine.infrastructure.cluster.x-k8s.io/cncfocicapi-control-plane-vkrjc 5m32s +ocimachine.infrastructure.cluster.x-k8s.io/cncfocicapi-md-0-hd9wn-6pk7x 6m56s +ocimachine.infrastructure.cluster.x-k8s.io/cncfocicapi-md-0-hd9wn-fb8zn 6m57s +ocimachine.infrastructure.cluster.x-k8s.io/cncfocicapi-md-0-hd9wn-gvn2c 6m56s +ocimachine.infrastructure.cluster.x-k8s.io/cncfocicapi-md-0-hd9wn-h2kv2 6m56s +ocimachine.infrastructure.cluster.x-k8s.io/cncfocicapi-md-0-hd9wn-r5cws 6m56s +ocimachine.infrastructure.cluster.x-k8s.io/cncfocicapi-md-0-hd9wn-vlhqc 6m56s +ocimachine.infrastructure.cluster.x-k8s.io/sharingio-control-plane-247f4 26m +ocimachine.infrastructure.cluster.x-k8s.io/sharingio-control-plane-4j9h6 26m +ocimachine.infrastructure.cluster.x-k8s.io/sharingio-control-plane-rjqwb 26m + +NAME AGE +ocimachinetemplate.infrastructure.cluster.x-k8s.io/cncfocicapi-control-plane 6m57s +ocimachinetemplate.infrastructure.cluster.x-k8s.io/cncfocicapi-md-0 6m57s +#+end_example + +Get the Talosconfig + +#+begin_src shell +kubectl -n sharingio get secret cncfocicapi-talosconfig -o go-template='{{ .data.talosconfig | base64decode }}' > ./talosconfig +#+end_src + +#+RESULTS: +#+begin_example +#+end_example + +Get the Kubeconfig + +#+begin_src shell +kubectl -n sharingio get secret sharingio-kubeconfig -o go-template='{{ .data.value | base64decode }}' > ./kubeconfig +#+end_src + +#+RESULTS: +#+begin_example #+end_example Tear down @@ -190,11 +224,11 @@ kubectl -n sharingio delete -f ./cluster.yaml 2>&1 #+RESULTS: #+begin_example -Error from server (NotFound): error when deleting "./cluster.yaml": clusters.cluster.x-k8s.io "sharingio" not found -Error from server (NotFound): error when deleting "./cluster.yaml": ociclusters.infrastructure.cluster.x-k8s.io "sharingio" not found -Error from server (NotFound): error when deleting "./cluster.yaml": taloscontrolplanes.controlplane.cluster.x-k8s.io "sharingio-control-plane" not found -Error from server (NotFound): error when deleting "./cluster.yaml": ocimachinetemplates.infrastructure.cluster.x-k8s.io "sharingio-control-plane" not found -Error from server (NotFound): error when deleting "./cluster.yaml": ocimachinetemplates.infrastructure.cluster.x-k8s.io "sharingio-md-0" not found -Error from server (NotFound): error when deleting "./cluster.yaml": talosconfigtemplates.bootstrap.cluster.x-k8s.io "sharingio-md-0" not found -Error from server (NotFound): error when deleting "./cluster.yaml": machinedeployments.cluster.x-k8s.io "sharingio-md-0" not found +cluster.cluster.x-k8s.io "cncfocicapi" deleted +ocicluster.infrastructure.cluster.x-k8s.io "cncfocicapi" deleted +taloscontrolplane.controlplane.cluster.x-k8s.io "cncfocicapi-control-plane" deleted +ocimachinetemplate.infrastructure.cluster.x-k8s.io "cncfocicapi-control-plane" deleted +ocimachinetemplate.infrastructure.cluster.x-k8s.io "cncfocicapi-md-0" deleted +talosconfigtemplate.bootstrap.cluster.x-k8s.io "cncfocicapi-md-0" deleted +Error from server (NotFound): error when deleting "./cluster.yaml": machinedeployments.cluster.x-k8s.io "cncfocicapi-md-0" not found #+end_example diff --git a/terraform/oci-capi-cluster/cluster-template.yaml b/terraform/oci-capi-cluster/cluster-template.yaml index 0c849c2..c4c6430 100644 --- a/terraform/oci-capi-cluster/cluster-template.yaml +++ b/terraform/oci-capi-cluster/cluster-template.yaml @@ -36,8 +36,8 @@ metadata: spec: compartmentId: ${OCI_COMPARTMENT_ID} --- -kind: TalosControlPlane apiVersion: controlplane.cluster.x-k8s.io/v1alpha3 +kind: TalosControlPlane metadata: name: "${CLUSTER_NAME}-control-plane" namespace: sharingio @@ -105,6 +105,10 @@ spec: nsgIds: - ${OCI_NETWORK_SECURITY_GROUP_ID} subnetId: ${OCI_NETWORK_SUBNET_ID} + vnicAttachments: + - displayName: primary + assignPublicIp: true + subnetName: ${OCI_NETWORK_SUBNET_NAME} --- apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: OCIMachineTemplate @@ -125,8 +129,15 @@ spec: shape: ${OCI_NODE_MACHINE_TYPE} shapeConfig: ocpus: "${OCI_NODE_MACHINE_TYPE_OCPUS}" - # networkDetails: - # assignPublicIp: true + networkDetails: + assignPublicIp: true + nsgIds: + - ${OCI_NETWORK_SECURITY_GROUP_ID} + subnetId: ${OCI_NETWORK_SUBNET_ID} + vnicAttachments: + - displayName: primary + assignPublicIp: true + subnetName: ${OCI_NETWORK_SUBNET_NAME} --- apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3 kind: TalosConfigTemplate diff --git a/terraform/oci-capi-cluster/cluster.yaml b/terraform/oci-capi-cluster/cluster.yaml deleted file mode 100644 index 1621bb6..0000000 --- a/terraform/oci-capi-cluster/cluster.yaml +++ /dev/null @@ -1,172 +0,0 @@ -apiVersion: cluster.x-k8s.io/v1beta1 -kind: Cluster -metadata: - labels: - cluster.x-k8s.io/cluster-name: sharingio - name: sharingio - namespace: sharingio -spec: - clusterNetwork: - pods: - cidrBlocks: - - 192.168.0.0/16 - serviceDomain: cluster.local - services: - cidrBlocks: - - 10.128.0.0/12 - controlPlaneRef: - apiVersion: controlplane.cluster.x-k8s.io/v1alpha3 - kind: TalosControlPlane - name: sharingio-control-plane - namespace: sharingio - infrastructureRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 - kind: OCICluster - name: sharingio - namespace: sharingio ---- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 -kind: OCICluster -metadata: - labels: - cluster.x-k8s.io/cluster-name: sharingio - name: sharingio - namespace: sharingio -spec: - compartmentId: ocid1.compartment.oc1..aaaaaaaac5nbffbezgxubg53nem624gylmjihujtw4ypafwoxp3mvrmcu5ba ---- -apiVersion: controlplane.cluster.x-k8s.io/v1alpha3 -kind: TalosControlPlane -metadata: - name: sharingio-control-plane - namespace: sharingio -spec: - controlPlaneConfig: - controlplane: - configPatches: - - op: replace - path: /machine/install - value: - bootloader: true - disk: /dev/sda - image: factory.talos.dev/installer/d01e4eb407f9a242831748cab07de55550fdcfe8be65ce4defd258a93d94562f:v1.7.6 - wipe: false - - op: add - path: /machine/kubelet/extraArgs - value: - cloud-provider: external - provider-id: oci://{{ ds["id"] }} - - op: add - path: /cluster/apiServer/extraArgs - value: - cloud-provider: external - - op: add - path: /cluster/controllerManager/extraArgs - value: - cloud-provider: external - - op: add - path: /cluster/allowSchedulingOnMasters - value: true - generateType: controlplane - infrastructureTemplate: - apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 - kind: OCIMachineTemplate - name: sharingio-control-plane - replicas: 3 - version: v1.30.1 ---- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 -kind: OCIMachineTemplate -metadata: - name: sharingio-control-plane - namespace: sharingio -spec: - template: - spec: - compartmentId: ocid1.compartment.oc1..aaaaaaaac5nbffbezgxubg53nem624gylmjihujtw4ypafwoxp3mvrmcu5ba - imageId: ocid1.image.oc1.us-sanjose-1.aaaaaaaaqemyxu4dnhuapt6dfzuhq6rp5h3f7ld3yqh3crwiu5qtzlk6woma - isPvEncryptionInTransitEnabled: true - metadata: - ssh_authorized_keys: "" - networkDetails: - assignPublicIp: true - nsgIds: - - ocid1.networksecuritygroup.oc1.us-sanjose-1.aaaaaaaagzhulfmzkzmcdc5hr33wfvpqmxeq2bgjs5inchmzoi6s7vhzlvjq - subnetId: ocid1.subnet.oc1.us-sanjose-1.aaaaaaaan27lv43bzsga256p2im3iuwf5ktlbu7u56tmv4rb7zzuna3c5oaq - shape: VM.Standard.A1.Flex - shapeConfig: - ocpus: "4" ---- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 -kind: OCIMachineTemplate -metadata: - name: sharingio-md-0 - namespace: sharingio -spec: - template: - spec: - compartmentId: ocid1.compartment.oc1..aaaaaaaac5nbffbezgxubg53nem624gylmjihujtw4ypafwoxp3mvrmcu5ba - imageId: ocid1.image.oc1.us-sanjose-1.aaaaaaaaqemyxu4dnhuapt6dfzuhq6rp5h3f7ld3yqh3crwiu5qtzlk6woma - isPvEncryptionInTransitEnabled: true - metadata: - ssh_authorized_keys: "" - shape: VM.Standard.A1.Flex - shapeConfig: - ocpus: "8" ---- -apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3 -kind: TalosConfigTemplate -metadata: - labels: - cluster.x-k8s.io/cluster-name: sharingio - name: sharingio-md-0 - namespace: sharingio -spec: - template: - spec: - configPatches: - - op: replace - path: /machine/install - value: - bootloader: true - disk: /dev/sda - image: factory.talos.dev/installer/d01e4eb407f9a242831748cab07de55550fdcfe8be65ce4defd258a93d94562f:v1.7.6 - wipe: false - - op: add - path: /machine/kubelet/extraArgs - value: - cloud-provider: external - provider-id: oci://{{ ds["id"] }} - - op: add - path: /cluster/apiServer/extraArgs - value: - cloud-provider: external - - op: add - path: /cluster/controllerManager/extraArgs - value: - cloud-provider: external - generateType: join ---- -apiVersion: cluster.x-k8s.io/v1beta1 -kind: MachineDeployment -metadata: - name: sharingio-md-0 - namespace: sharingio -spec: - clusterName: sharingio - replicas: 6 - selector: - matchLabels: null - template: - spec: - bootstrap: - configRef: - apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3 - kind: TalosConfigTemplate - name: sharingio-md-0 - clusterName: sharingio - infrastructureRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 - kind: OCIMachineTemplate - name: sharingio-md-0 - version: v1.30.1 From 1be2a98dc6a2438b42cd0d68203f29e005b8cd39 Mon Sep 17 00:00:00 2001 From: Caleb Woodbine Date: Tue, 3 Sep 2024 11:44:07 +1200 Subject: [PATCH 4/5] chore: drop specified vnic attachments use defaults --- terraform/oci-capi-cluster/cluster-template.yaml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/terraform/oci-capi-cluster/cluster-template.yaml b/terraform/oci-capi-cluster/cluster-template.yaml index c4c6430..775b8b0 100644 --- a/terraform/oci-capi-cluster/cluster-template.yaml +++ b/terraform/oci-capi-cluster/cluster-template.yaml @@ -105,10 +105,6 @@ spec: nsgIds: - ${OCI_NETWORK_SECURITY_GROUP_ID} subnetId: ${OCI_NETWORK_SUBNET_ID} - vnicAttachments: - - displayName: primary - assignPublicIp: true - subnetName: ${OCI_NETWORK_SUBNET_NAME} --- apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: OCIMachineTemplate @@ -134,10 +130,6 @@ spec: nsgIds: - ${OCI_NETWORK_SECURITY_GROUP_ID} subnetId: ${OCI_NETWORK_SUBNET_ID} - vnicAttachments: - - displayName: primary - assignPublicIp: true - subnetName: ${OCI_NETWORK_SUBNET_NAME} --- apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3 kind: TalosConfigTemplate From 1d72182f7a96d2eccbb6c8507f17e3f3961dca40 Mon Sep 17 00:00:00 2001 From: Caleb Woodbine Date: Wed, 4 Sep 2024 09:20:12 +1200 Subject: [PATCH 5/5] chore: update readme - command for getting resources - command for deleting the cluster --- terraform/oci-capi-cluster/README.org | 93 ++++++++++++--------------- 1 file changed, 42 insertions(+), 51 deletions(-) diff --git a/terraform/oci-capi-cluster/README.org b/terraform/oci-capi-cluster/README.org index cbea3a9..d1fc482 100644 --- a/terraform/oci-capi-cluster/README.org +++ b/terraform/oci-capi-cluster/README.org @@ -124,76 +124,67 @@ machinedeployment.cluster.x-k8s.io/cncfocicapi-md-0 created view the world #+begin_src shell -kubectl -n sharingio get $(kubectl -n sharingio api-resources | grep x-k8s | awk '{print $1}' | tr '\n' ',' | sed 's/,$//g') +( +kubectl -n sharingio get "$(kubectl -n sharingio api-resources | grep x-k8s | awk '{print $1}' | tr '\n' ',' | sed 's/,$//g')" +) 2>&1 ; : #+end_src #+RESULTS: #+begin_example NAME AGE -talosconfig.bootstrap.cluster.x-k8s.io/cncfocicapi-control-plane-9798j 5m32s -talosconfig.bootstrap.cluster.x-k8s.io/cncfocicapi-control-plane-fkrbr 5m33s -talosconfig.bootstrap.cluster.x-k8s.io/cncfocicapi-control-plane-tjv2n 5m32s -talosconfig.bootstrap.cluster.x-k8s.io/cncfocicapi-md-0-hd9wn-6pk7x 6m56s -talosconfig.bootstrap.cluster.x-k8s.io/cncfocicapi-md-0-hd9wn-fb8zn 6m57s -talosconfig.bootstrap.cluster.x-k8s.io/cncfocicapi-md-0-hd9wn-gvn2c 6m56s -talosconfig.bootstrap.cluster.x-k8s.io/cncfocicapi-md-0-hd9wn-h2kv2 6m56s -talosconfig.bootstrap.cluster.x-k8s.io/cncfocicapi-md-0-hd9wn-r5cws 6m56s -talosconfig.bootstrap.cluster.x-k8s.io/cncfocicapi-md-0-hd9wn-vlhqc 6m56s -talosconfig.bootstrap.cluster.x-k8s.io/sharingio-control-plane-c7qpb 26m -talosconfig.bootstrap.cluster.x-k8s.io/sharingio-control-plane-z7j4r 26m -talosconfig.bootstrap.cluster.x-k8s.io/sharingio-control-plane-zj9g5 26m +talosconfig.bootstrap.cluster.x-k8s.io/cncfocicapi-control-plane-2zmxv 2m53s +talosconfig.bootstrap.cluster.x-k8s.io/cncfocicapi-control-plane-6ntpr 2m53s +talosconfig.bootstrap.cluster.x-k8s.io/cncfocicapi-control-plane-zc7jw 2m53s +talosconfig.bootstrap.cluster.x-k8s.io/cncfocicapi-md-0-h68x6-8lpll 4m13s +talosconfig.bootstrap.cluster.x-k8s.io/cncfocicapi-md-0-h68x6-cv7jd 4m13s +talosconfig.bootstrap.cluster.x-k8s.io/cncfocicapi-md-0-h68x6-kzjq5 4m13s +talosconfig.bootstrap.cluster.x-k8s.io/cncfocicapi-md-0-h68x6-p4smf 4m13s +talosconfig.bootstrap.cluster.x-k8s.io/cncfocicapi-md-0-h68x6-rmjb6 4m13s +talosconfig.bootstrap.cluster.x-k8s.io/cncfocicapi-md-0-h68x6-s67hr 4m13s NAME AGE -talosconfigtemplate.bootstrap.cluster.x-k8s.io/cncfocicapi-md-0 6m57s +talosconfigtemplate.bootstrap.cluster.x-k8s.io/cncfocicapi-md-0 4m13s NAME CLUSTERCLASS PHASE AGE VERSION -cluster.cluster.x-k8s.io/cncfocicapi Provisioned 6m57s -cluster.cluster.x-k8s.io/sharingio Deleting 27m +cluster.cluster.x-k8s.io/cncfocicapi Provisioned 4m14s NAME CLUSTER REPLICAS READY UPDATED UNAVAILABLE PHASE AGE VERSION -machinedeployment.cluster.x-k8s.io/cncfocicapi-md-0 cncfocicapi 6 6 6 ScalingUp 6m57s v1.30.1 +machinedeployment.cluster.x-k8s.io/cncfocicapi-md-0 cncfocicapi 6 6 6 ScalingUp 4m13s v1.30.1 NAME CLUSTER NODENAME PROVIDERID PHASE AGE VERSION -machine.cluster.x-k8s.io/cncfocicapi-control-plane-phr6z cncfocicapi Provisioning 5m32s v1.30.1 -machine.cluster.x-k8s.io/cncfocicapi-control-plane-qq5zq cncfocicapi Provisioning 5m32s v1.30.1 -machine.cluster.x-k8s.io/cncfocicapi-control-plane-rg2xt cncfocicapi Provisioning 5m32s v1.30.1 -machine.cluster.x-k8s.io/cncfocicapi-md-0-hd9wn-6pk7x cncfocicapi Pending 6m56s v1.30.1 -machine.cluster.x-k8s.io/cncfocicapi-md-0-hd9wn-fb8zn cncfocicapi Pending 6m56s v1.30.1 -machine.cluster.x-k8s.io/cncfocicapi-md-0-hd9wn-gvn2c cncfocicapi Pending 6m56s v1.30.1 -machine.cluster.x-k8s.io/cncfocicapi-md-0-hd9wn-h2kv2 cncfocicapi Pending 6m56s v1.30.1 -machine.cluster.x-k8s.io/cncfocicapi-md-0-hd9wn-r5cws cncfocicapi Pending 6m56s v1.30.1 -machine.cluster.x-k8s.io/cncfocicapi-md-0-hd9wn-vlhqc cncfocicapi Pending 6m56s v1.30.1 -machine.cluster.x-k8s.io/sharingio-control-plane-6kn5v sharingio Deleting 26m v1.30.1 -machine.cluster.x-k8s.io/sharingio-control-plane-8ntmx sharingio Deleting 26m v1.30.1 -machine.cluster.x-k8s.io/sharingio-control-plane-bfv5k sharingio Deleting 26m v1.30.1 +machine.cluster.x-k8s.io/cncfocicapi-control-plane-h59cd cncfocicapi Provisioning 2m53s v1.30.1 +machine.cluster.x-k8s.io/cncfocicapi-control-plane-mrmqj cncfocicapi Provisioning 2m53s v1.30.1 +machine.cluster.x-k8s.io/cncfocicapi-control-plane-st9j6 cncfocicapi Provisioning 2m53s v1.30.1 +machine.cluster.x-k8s.io/cncfocicapi-md-0-h68x6-8lpll cncfocicapi Pending 4m13s v1.30.1 +machine.cluster.x-k8s.io/cncfocicapi-md-0-h68x6-cv7jd cncfocicapi Pending 4m13s v1.30.1 +machine.cluster.x-k8s.io/cncfocicapi-md-0-h68x6-kzjq5 cncfocicapi Pending 4m13s v1.30.1 +machine.cluster.x-k8s.io/cncfocicapi-md-0-h68x6-p4smf cncfocicapi Pending 4m13s v1.30.1 +machine.cluster.x-k8s.io/cncfocicapi-md-0-h68x6-rmjb6 cncfocicapi Pending 4m13s v1.30.1 +machine.cluster.x-k8s.io/cncfocicapi-md-0-h68x6-s67hr cncfocicapi Pending 4m13s v1.30.1 NAME CLUSTER REPLICAS READY AVAILABLE AGE VERSION -machineset.cluster.x-k8s.io/cncfocicapi-md-0-hd9wn cncfocicapi 6 6m57s v1.30.1 +machineset.cluster.x-k8s.io/cncfocicapi-md-0-h68x6 cncfocicapi 6 4m13s v1.30.1 NAME READY INITIALIZED REPLICAS READY REPLICAS UNAVAILABLE REPLICAS taloscontrolplane.controlplane.cluster.x-k8s.io/cncfocicapi-control-plane 3 3 -taloscontrolplane.controlplane.cluster.x-k8s.io/sharingio-control-plane 3 3 NAME AGE -ocicluster.infrastructure.cluster.x-k8s.io/cncfocicapi 6m57s +ocicluster.infrastructure.cluster.x-k8s.io/cncfocicapi 4m14s NAME AGE -ocimachine.infrastructure.cluster.x-k8s.io/cncfocicapi-control-plane-5m2ln 5m33s -ocimachine.infrastructure.cluster.x-k8s.io/cncfocicapi-control-plane-phxbg 5m32s -ocimachine.infrastructure.cluster.x-k8s.io/cncfocicapi-control-plane-vkrjc 5m32s -ocimachine.infrastructure.cluster.x-k8s.io/cncfocicapi-md-0-hd9wn-6pk7x 6m56s -ocimachine.infrastructure.cluster.x-k8s.io/cncfocicapi-md-0-hd9wn-fb8zn 6m57s -ocimachine.infrastructure.cluster.x-k8s.io/cncfocicapi-md-0-hd9wn-gvn2c 6m56s -ocimachine.infrastructure.cluster.x-k8s.io/cncfocicapi-md-0-hd9wn-h2kv2 6m56s -ocimachine.infrastructure.cluster.x-k8s.io/cncfocicapi-md-0-hd9wn-r5cws 6m56s -ocimachine.infrastructure.cluster.x-k8s.io/cncfocicapi-md-0-hd9wn-vlhqc 6m56s -ocimachine.infrastructure.cluster.x-k8s.io/sharingio-control-plane-247f4 26m -ocimachine.infrastructure.cluster.x-k8s.io/sharingio-control-plane-4j9h6 26m -ocimachine.infrastructure.cluster.x-k8s.io/sharingio-control-plane-rjqwb 26m +ocimachine.infrastructure.cluster.x-k8s.io/cncfocicapi-control-plane-4wq9n 2m53s +ocimachine.infrastructure.cluster.x-k8s.io/cncfocicapi-control-plane-g8jqg 2m53s +ocimachine.infrastructure.cluster.x-k8s.io/cncfocicapi-control-plane-jkhnf 2m53s +ocimachine.infrastructure.cluster.x-k8s.io/cncfocicapi-md-0-h68x6-8lpll 4m13s +ocimachine.infrastructure.cluster.x-k8s.io/cncfocicapi-md-0-h68x6-cv7jd 4m13s +ocimachine.infrastructure.cluster.x-k8s.io/cncfocicapi-md-0-h68x6-kzjq5 4m13s +ocimachine.infrastructure.cluster.x-k8s.io/cncfocicapi-md-0-h68x6-p4smf 4m13s +ocimachine.infrastructure.cluster.x-k8s.io/cncfocicapi-md-0-h68x6-rmjb6 4m13s +ocimachine.infrastructure.cluster.x-k8s.io/cncfocicapi-md-0-h68x6-s67hr 4m13s NAME AGE -ocimachinetemplate.infrastructure.cluster.x-k8s.io/cncfocicapi-control-plane 6m57s -ocimachinetemplate.infrastructure.cluster.x-k8s.io/cncfocicapi-md-0 6m57s +ocimachinetemplate.infrastructure.cluster.x-k8s.io/cncfocicapi-control-plane 4m13s +ocimachinetemplate.infrastructure.cluster.x-k8s.io/cncfocicapi-md-0 4m13s #+end_example Get the Talosconfig @@ -219,16 +210,16 @@ kubectl -n sharingio get secret sharingio-kubeconfig -o go-template='{{ .data.va Tear down #+begin_src shell -kubectl -n sharingio delete -f ./cluster.yaml 2>&1 +kubectl -n sharingio delete cluster cncfocicapi #+end_src #+RESULTS: #+begin_example cluster.cluster.x-k8s.io "cncfocicapi" deleted -ocicluster.infrastructure.cluster.x-k8s.io "cncfocicapi" deleted taloscontrolplane.controlplane.cluster.x-k8s.io "cncfocicapi-control-plane" deleted -ocimachinetemplate.infrastructure.cluster.x-k8s.io "cncfocicapi-control-plane" deleted -ocimachinetemplate.infrastructure.cluster.x-k8s.io "cncfocicapi-md-0" deleted -talosconfigtemplate.bootstrap.cluster.x-k8s.io "cncfocicapi-md-0" deleted +Error from server (NotFound): error when deleting "./cluster.yaml": ociclusters.infrastructure.cluster.x-k8s.io "cncfocicapi" not found +Error from server (NotFound): error when deleting "./cluster.yaml": ocimachinetemplates.infrastructure.cluster.x-k8s.io "cncfocicapi-control-plane" not found +Error from server (NotFound): error when deleting "./cluster.yaml": ocimachinetemplates.infrastructure.cluster.x-k8s.io "cncfocicapi-md-0" not found +Error from server (NotFound): error when deleting "./cluster.yaml": talosconfigtemplates.bootstrap.cluster.x-k8s.io "cncfocicapi-md-0" not found Error from server (NotFound): error when deleting "./cluster.yaml": machinedeployments.cluster.x-k8s.io "cncfocicapi-md-0" not found #+end_example