-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from canonical/MK-879/gcp
Add GCP cluster template
- Loading branch information
Showing
3 changed files
with
149 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Kubernetes cluster configuration | ||
export KUBERNETES_VERSION=1.25.0 | ||
export CONTROL_PLANE_MACHINE_COUNT=1 | ||
export WORKER_MACHINE_COUNT=1 | ||
|
||
# GCP configuration | ||
export GCP_REGION="europe-west" | ||
export GCP_NETWORK_NAME="default" | ||
export GCP_PROJECT="my-gcp-project-name" | ||
|
||
# GCP machine configuration | ||
export GCP_PUBLIC_IP=true # set to false if you have configured a cloud NAT | ||
export GCP_CONTROL_PLANE_MACHINE_TYPE=n1-standard-2 | ||
export GCP_NODE_MACHINE_TYPE=n1-standard-2 | ||
export IMAGE_ID=projects/$GCP_PROJECT/global/images/ubuntu-2204 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
# Based on https://github.com/kubernetes-sigs/cluster-api-provider-aws/releases/download/v1.5.0/cluster-template.yaml | ||
--- | ||
apiVersion: cluster.x-k8s.io/v1beta1 | ||
kind: Cluster | ||
metadata: | ||
name: ${CLUSTER_NAME} | ||
spec: | ||
clusterNetwork: | ||
apiServerPort: 6443 | ||
infrastructureRef: | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 | ||
kind: GCPCluster | ||
name: ${CLUSTER_NAME} | ||
controlPlaneRef: | ||
kind: MicroK8sControlPlane | ||
apiVersion: controlplane.cluster.x-k8s.io/v1beta1 | ||
name: ${CLUSTER_NAME}-control-plane | ||
--- | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 | ||
kind: GCPCluster | ||
metadata: | ||
name: ${CLUSTER_NAME} | ||
spec: | ||
project: "${GCP_PROJECT}" | ||
region: "${GCP_REGION}" | ||
network: | ||
name: "${GCP_NETWORK_NAME}" | ||
--- | ||
apiVersion: controlplane.cluster.x-k8s.io/v1beta1 | ||
kind: MicroK8sControlPlane | ||
metadata: | ||
name: "${CLUSTER_NAME}-control-plane" | ||
spec: | ||
controlPlaneConfig: | ||
initConfiguration: | ||
joinTokenTTLInSecs: 900000 | ||
IPinIP: true | ||
addons: | ||
- dns | ||
- ingress | ||
clusterConfiguration: | ||
portCompatibilityRemap: true | ||
machineTemplate: | ||
infrastructureTemplate: | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 | ||
kind: GCPMachineTemplate | ||
name: "${CLUSTER_NAME}-control-plane" | ||
replicas: ${CONTROL_PLANE_MACHINE_COUNT:=1} | ||
version: "v${KUBERNETES_VERSION}" | ||
--- | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 | ||
kind: GCPMachineTemplate | ||
metadata: | ||
name: ${CLUSTER_NAME}-control-plane | ||
spec: | ||
template: | ||
spec: | ||
instanceType: "${GCP_CONTROL_PLANE_MACHINE_TYPE}" | ||
image: "${IMAGE_ID}" | ||
publicIP: ${GCP_PUBLIC_IP} | ||
--- | ||
apiVersion: cluster.x-k8s.io/v1beta1 | ||
kind: MachineDeployment | ||
metadata: | ||
name: "${CLUSTER_NAME}-md-0" | ||
spec: | ||
clusterName: "${CLUSTER_NAME}" | ||
replicas: ${WORKER_MACHINE_COUNT:=1} | ||
selector: | ||
matchLabels: | ||
template: | ||
spec: | ||
clusterName: "${CLUSTER_NAME}" | ||
version: "${KUBERNETES_VERSION}" | ||
bootstrap: | ||
configRef: | ||
name: "${CLUSTER_NAME}-md-0" | ||
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 | ||
kind: MicroK8sConfigTemplate | ||
infrastructureRef: | ||
name: "${CLUSTER_NAME}-md-0" | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 | ||
kind: GCPMachineTemplate | ||
--- | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 | ||
kind: GCPMachineTemplate | ||
metadata: | ||
name: ${CLUSTER_NAME}-md-0 | ||
spec: | ||
template: | ||
spec: | ||
instanceType: "${GCP_NODE_MACHINE_TYPE}" | ||
image: "${IMAGE_ID}" | ||
--- | ||
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 | ||
kind: MicroK8sConfigTemplate | ||
metadata: | ||
name: "${CLUSTER_NAME}-md-0" | ||
spec: | ||
template: | ||
spec: | ||
clusterConfiguration: | ||
portCompatibilityRemap: true |