-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
76 lines (66 loc) · 2.6 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
AWS_ACCOUNT_ID := $(shell aws sts get-caller-identity --query Account --output text)
AWS_REGION ?= eu-north-1
GITHUB_USER ?= lreimer
GCP_PROJECT ?= cloud-native-experience-lab
GCP_REGION ?= europe-north1
GCP_ZONE ?= europe-north1-b
create-eks-cluster:
@eksctl create cluster -f eks-cluster.yaml
bootstrap-eks-flux2:
@flux bootstrap github \
--owner=$(GITHUB_USER) \
--repository=k8s-native-iac \
--branch=main \
--path=./clusters/eks-cluster \
--components-extra=image-reflector-controller,image-automation-controller \
--read-write-key \
--personal
prepare-gke-cluster:
@gcloud config set compute/zone europe-west1-b
@gcloud config set container/use_client_certificate False
create-gke-cluster:
@gcloud container clusters create gke-k8s-iac-cluster \
--addons HttpLoadBalancing,HorizontalPodAutoscaling,ConfigConnector \
--workload-pool=$(GCP_PROJECT).svc.id.goog \
--enable-autoscaling \
--autoscaling-profile=optimize-utilization \
--num-nodes=2 \
--min-nodes=2 --max-nodes=5 \
--machine-type=e2-standard-2 \
--logging=SYSTEM \
--monitoring=SYSTEM \
--region=$(GCP_REGION) \
--release-channel=stable \
--cluster-version=1.27
@kubectl create clusterrolebinding cluster-admin-binding --clusterrole=cluster-admin --user=$$(gcloud config get-value core/account)
@kubectl cluster-info
bootstrap-gke-flux2:
@flux bootstrap github \
--owner=$(GITHUB_USER) \
--repository=k8s-native-iac \
--branch=main \
--path=./clusters/gke-cluster \
--components-extra=image-reflector-controller,image-automation-controller \
--read-write-key \
--personal
prepare-capi-aws:
# create an SSH key
@export AWS_REGION=$(AWS_REGION)
@export AWS_ACCESS_KEY_ID=<INSERT>
@export AWS_SECRET_ACCESS_KEY=<INSERT>
@clusterawsadm bootstrap iam create-cloudformation-stack --config bootstrap-config.yaml
install-capi-aws:
# required to avoid API rate limiting
@echo "You may need to set a personal GITHUB_TOKEN to avoid API rate limiting"
@export AWS_REGION=$(AWS_REGION)
@export AWS_SSH_KEY_NAME=capi-default
@export AWS_CONTROL_PLANE_MACHINE_TYPE=t3.medium
@export AWS_NODE_MACHINE_TYPE=t3.medium
@export AWS_B64ENCODED_CREDENTIALS=$(shell clusterawsadm bootstrap credentials encode-as-profile)
@clusterctl init --infrastructure aws
delete-clusters: delete-eks-cluster delete-gke-cluster
delete-eks-cluster:
@eksctl delete cluster --region=eu-north-1 --name=eks-k8s-iac-cluster
@aws cloudformation delete-stack --region eu-north-1 --stack-name eksctl-eks-k8s-iac-cluster-cluster
delete-gke-cluster:
@gcloud container clusters delete gke-k8s-iac-cluster --region=$(GCP_REGION) --async --quiet