|
| 1 | +# Cluster Stacks |
| 2 | + |
| 3 | +## Getting started |
| 4 | + |
| 5 | +```sh |
| 6 | +# Create bootstrap cluster |
| 7 | +kind create cluster |
| 8 | + |
| 9 | +# Init Cluster API |
| 10 | +export CLUSTER_TOPOLOGY=true |
| 11 | +export EXP_CLUSTER_RESOURCE_SET=true |
| 12 | +export EXP_RUNTIME_SDK=true |
| 13 | +kubectl apply -f https://github.com/k-orc/openstack-resource-controller/releases/latest/download/install.yaml |
| 14 | +clusterctl init --infrastructure openstack |
| 15 | + |
| 16 | +kubectl -n capi-system rollout status deployment |
| 17 | +kubectl -n capo-system rollout status deployment |
| 18 | +``` |
| 19 | + |
| 20 | +``` |
| 21 | +# Install CSO and CSPO |
| 22 | +helm upgrade -i cso \ |
| 23 | +-n cso-system \ |
| 24 | +--create-namespace \ |
| 25 | +oci://registry.scs.community/cluster-stacks/cso |
| 26 | +``` |
| 27 | + |
| 28 | +```sh |
| 29 | +export CLUSTER_NAMESPACE=cluster |
| 30 | +export CLUSTER_NAME=my-cluster |
| 31 | +export CLUSTERSTACK_NAMESPACE=cluster |
| 32 | +export CLUSTERSTACK_VERSION=v1 |
| 33 | +export OS_CLIENT_CONFIG_FILE=${PWD}/clouds.yaml |
| 34 | +kubectl create namespace $CLUSTER_NAMESPACE --dry-run=client -o yaml | kubectl apply -f - |
| 35 | +``` |
| 36 | + |
| 37 | +```sh |
| 38 | +# Create secret for CAPO |
| 39 | +kubectl create secret -n $CLUSTER_NAMESPACE generic openstack --from-file=clouds.yaml=$OS_CLIENT_CONFIG_FILE --dry-run=client -oyaml | kubectl apply -f - |
| 40 | + |
| 41 | +# Prepare the Secret as it will be deployed in the Workload Cluster |
| 42 | +kubectl create secret -n kube-system generic clouds-yaml --from-file=clouds.yaml=$OS_CLIENT_CONFIG_FILE --dry-run=client -oyaml > clouds-yaml-secret |
| 43 | + |
| 44 | +# Add the Secret to the ClusterResourceSet Secret in the Management Cluster |
| 45 | +kubectl create -n $CLUSTER_NAMESPACE secret generic clouds-yaml --from-file=clouds-yaml-secret --type=addons.cluster.x-k8s.io/resource-set --dry-run=client -oyaml | kubectl apply -f - |
| 46 | +``` |
| 47 | + |
| 48 | +```yaml |
| 49 | +cat <<EOF | kubectl apply -f - |
| 50 | +apiVersion: addons.cluster.x-k8s.io/v1beta1 |
| 51 | +kind: ClusterResourceSet |
| 52 | +metadata: |
| 53 | + name: clouds-yaml |
| 54 | + namespace: $CLUSTER_NAMESPACE |
| 55 | +spec: |
| 56 | + strategy: "Reconcile" |
| 57 | + clusterSelector: |
| 58 | + matchLabels: |
| 59 | + managed-secret: clouds-yaml |
| 60 | + resources: |
| 61 | + - name: clouds-yaml |
| 62 | + kind: Secret |
| 63 | +EOF |
| 64 | +``` |
| 65 | + |
| 66 | +```sh |
| 67 | +# Apply ClusterStack resource |
| 68 | +cat <<EOF | kubectl apply -f - |
| 69 | +apiVersion: clusterstack.x-k8s.io/v1alpha1 |
| 70 | +kind: ClusterStack |
| 71 | +metadata: |
| 72 | + name: openstack |
| 73 | + namespace: $CLUSTERSTACK_NAMESPACE |
| 74 | +spec: |
| 75 | + provider: openstack |
| 76 | + name: scs2 |
| 77 | + kubernetesVersion: "1.33" |
| 78 | + channel: stable |
| 79 | + autoSubscribe: false |
| 80 | + noProvider: true |
| 81 | + versions: |
| 82 | + - $CLUSTERSTACK_VERSION |
| 83 | +EOF |
| 84 | +``` |
| 85 | + |
| 86 | +```sh |
| 87 | +# Apply Cluster resource |
| 88 | +cat <<EOF | kubectl apply -f - |
| 89 | +apiVersion: cluster.x-k8s.io/v1beta1 |
| 90 | +kind: Cluster |
| 91 | +metadata: |
| 92 | + name: $CLUSTER_NAME |
| 93 | + namespace: $CLUSTER_NAMESPACE |
| 94 | +
|
| 95 | + labels: |
| 96 | + managed-secret: clouds-yaml |
| 97 | +spec: |
| 98 | + clusterNetwork: |
| 99 | + pods: |
| 100 | + cidrBlocks: |
| 101 | + - "172.16.0.0/16" |
| 102 | + serviceDomain: cluster.local |
| 103 | + services: |
| 104 | + cidrBlocks: |
| 105 | + - "10.96.0.0/12" |
| 106 | + topology: |
| 107 | + variables: |
| 108 | + class: openstack-scs2-1-33-$CLUSTERSTACK_VERSION |
| 109 | + classNamespace: $CLUSTERSTACK_NAMESPACE |
| 110 | + controlPlane: |
| 111 | + replicas: 1 |
| 112 | + version: v1.33.4 |
| 113 | + workers: |
| 114 | + machineDeployments: |
| 115 | + - class: default-worker |
| 116 | + name: md-0 |
| 117 | + replicas: 1 |
| 118 | +EOF |
| 119 | +``` |
| 120 | + |
| 121 | +```sh |
| 122 | +clusterctl get kubeconfig -n $CLUSTER_NAMESPACE openstack-testcluster > /tmp/kubeconfig |
| 123 | +kubectl get nodes --kubeconfig /tmp/kubeconfig |
| 124 | +``` |
0 commit comments