|
| 1 | +apiVersion: v1 |
| 2 | +kind: Namespace |
| 3 | +metadata: |
| 4 | + name: ${CABPR_NAMESPACE} |
| 5 | +--- |
| 6 | +apiVersion: cluster.x-k8s.io/v1beta1 |
| 7 | +kind: Cluster |
| 8 | +metadata: |
| 9 | + namespace: ${CABPR_NAMESPACE} |
| 10 | + name: ${CLUSTER_NAME} |
| 11 | +spec: |
| 12 | + clusterNetwork: |
| 13 | + pods: |
| 14 | + cidrBlocks: |
| 15 | + - 10.45.0.0/16 |
| 16 | + services: |
| 17 | + cidrBlocks: |
| 18 | + - 10.46.0.0/16 |
| 19 | + serviceDomain: cluster.local |
| 20 | + controlPlaneRef: |
| 21 | + apiVersion: controlplane.cluster.x-k8s.io/v1alpha1 |
| 22 | + kind: RKE2ControlPlane |
| 23 | + name: ${CLUSTER_NAME}-control-plane |
| 24 | + infrastructureRef: |
| 25 | + apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 |
| 26 | + kind: DockerCluster |
| 27 | + name: ${CLUSTER_NAME} |
| 28 | +--- |
| 29 | +apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 |
| 30 | +kind: DockerCluster |
| 31 | +metadata: |
| 32 | + name: ${CLUSTER_NAME} |
| 33 | + namespace: ${CABPR_NAMESPACE} |
| 34 | +--- |
| 35 | +apiVersion: controlplane.cluster.x-k8s.io/v1alpha1 |
| 36 | +kind: RKE2ControlPlane |
| 37 | +metadata: |
| 38 | + name: ${CLUSTER_NAME}-control-plane |
| 39 | + namespace: ${CABPR_NAMESPACE} |
| 40 | +spec: |
| 41 | + replicas: ${CABPR_CP_REPLICAS} |
| 42 | + agentConfig: |
| 43 | + version: ${KUBERNETES_VERSION}+rke2r1 |
| 44 | + serverConfig: |
| 45 | + cni: calico |
| 46 | + infrastructureRef: |
| 47 | + apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 |
| 48 | + kind: DockerMachineTemplate |
| 49 | + name: controlplane |
| 50 | + nodeDrainTimeout: 2m |
| 51 | + registrationMethod: "address" |
| 52 | + registrationAddress: "${REGISTRATION_VIP}" |
| 53 | + preRKE2Commands: |
| 54 | + - mkdir -p /var/lib/rancher/rke2/server/manifests/ && ctr images pull ghcr.io/kube-vip/kube-vip:v0.6.0 && ctr run --rm --net-host ghcr.io/kube-vip/kube-vip:v0.6.0 vip /kube-vip manifest daemonset --arp --interface $(ip -4 -j route list default | jq -r .[0].dev) --address ${REGISTRATION_VIP} --controlplane --leaderElection --taint --services --inCluster | tee /var/lib/rancher/rke2/server/manifests/kube-vip.yaml |
| 55 | + files: |
| 56 | + - path: /var/lib/rancher/rke2/server/manifests/kube-vip-rbac.yaml |
| 57 | + content: | |
| 58 | + apiVersion: v1 |
| 59 | + kind: ServiceAccount |
| 60 | + metadata: |
| 61 | + name: kube-vip |
| 62 | + namespace: kube-system |
| 63 | + --- |
| 64 | + apiVersion: rbac.authorization.k8s.io/v1 |
| 65 | + kind: ClusterRole |
| 66 | + metadata: |
| 67 | + annotations: |
| 68 | + rbac.authorization.kubernetes.io/autoupdate: "true" |
| 69 | + name: system:kube-vip-role |
| 70 | + rules: |
| 71 | + - apiGroups: [""] |
| 72 | + resources: ["services", "services/status", "nodes", "endpoints"] |
| 73 | + verbs: ["list","get","watch", "update"] |
| 74 | + - apiGroups: ["coordination.k8s.io"] |
| 75 | + resources: ["leases"] |
| 76 | + verbs: ["list", "get", "watch", "update", "create"] |
| 77 | + --- |
| 78 | + kind: ClusterRoleBinding |
| 79 | + apiVersion: rbac.authorization.k8s.io/v1 |
| 80 | + metadata: |
| 81 | + name: system:kube-vip-binding |
| 82 | + roleRef: |
| 83 | + apiGroup: rbac.authorization.k8s.io |
| 84 | + kind: ClusterRole |
| 85 | + name: system:kube-vip-role |
| 86 | + subjects: |
| 87 | + - kind: ServiceAccount |
| 88 | + name: kube-vip |
| 89 | + namespace: kube-system |
| 90 | + owner: root:root |
| 91 | +--- |
| 92 | +apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 |
| 93 | +kind: DockerMachineTemplate |
| 94 | +metadata: |
| 95 | + name: controlplane |
| 96 | + namespace: ${CABPR_NAMESPACE} |
| 97 | +spec: |
| 98 | + template: |
| 99 | + spec: {} |
| 100 | +--- |
| 101 | +apiVersion: cluster.x-k8s.io/v1beta1 |
| 102 | +kind: MachineDeployment |
| 103 | +metadata: |
| 104 | + name: worker-md-0 |
| 105 | + namespace: ${CABPR_NAMESPACE} |
| 106 | +spec: |
| 107 | + clusterName: ${CLUSTER_NAME} |
| 108 | + replicas: ${CABPR_WK_REPLICAS} |
| 109 | + selector: |
| 110 | + matchLabels: |
| 111 | + cluster.x-k8s.io/cluster-name: ${CLUSTER_NAME} |
| 112 | + template: |
| 113 | + spec: |
| 114 | + version: ${KUBERNETES_VERSION} |
| 115 | + clusterName: ${CLUSTER_NAME} |
| 116 | + bootstrap: |
| 117 | + configRef: |
| 118 | + apiVersion: bootstrap.cluster.x-k8s.io/v1alpha1 |
| 119 | + kind: RKE2ConfigTemplate |
| 120 | + name: ${CLUSTER_NAME}-agent |
| 121 | + namespace: ${CABPR_NAMESPACE} |
| 122 | + infrastructureRef: |
| 123 | + apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 |
| 124 | + kind: DockerMachineTemplate |
| 125 | + name: worker |
| 126 | + namespace: ${CABPR_NAMESPACE} |
| 127 | +--- |
| 128 | +apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 |
| 129 | +kind: DockerMachineTemplate |
| 130 | +metadata: |
| 131 | + name: worker |
| 132 | + namespace: ${CABPR_NAMESPACE} |
| 133 | +spec: |
| 134 | + template: |
| 135 | + spec: {} |
| 136 | +--- |
| 137 | +apiVersion: bootstrap.cluster.x-k8s.io/v1alpha1 |
| 138 | +kind: RKE2ConfigTemplate |
| 139 | +metadata: |
| 140 | + namespace: ${CABPR_NAMESPACE} |
| 141 | + name: ${CLUSTER_NAME}-agent |
| 142 | +spec: |
| 143 | + template: |
| 144 | + spec: |
| 145 | + agentConfig: |
| 146 | + version: ${KUBERNETES_VERSION}+rke2r1 |
0 commit comments