-
Notifications
You must be signed in to change notification settings - Fork 1
/
cluster.sh
51 lines (39 loc) · 1.45 KB
/
cluster.sh
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
#! /usr/sh
export AWS_REGION=us-east-1
echo "Using AWS region: $AWS_REGION"
export K8S_VERSION=1.17
echo "Using Kubernetes version: $K8S_VERSION"
# Check any existing EKS cluster
eksctl get cluster \
--region $AWS_REGION
# use profile "eks" and region "us-east-1"
# use matching kubectl version e.g. 1.17
# Refer: https://docs.aws.amazon.com/eks/latest/userguide/install-kubectl.html
eksctl create cluster --name tricentis-cluster --version $K8S_VERSION --region $AWS_REGION --nodegroup-name standard-workers --node-type t3.micro --nodes 3 --nodes-min 1 --nodes-max 4 --node-ami auto
# After 10 min or so, confirm again for desired EKS cluster
eksctl get cluster \
--region $AWS_REGION
# Typically the config file would be stored as
# ~/.kube/config
# If kubectl having port issues, run: aws eks --region $AWS_REGION update-kubeconfig --name tricentis-cluster
# Get the info of K8s cluster e.g. cluster IP
kubectl get svc
# Get the info of K8s nodes
kubectl get nodes
# Generate secret for MySQL db
kubectl create secret generic mysql-pass --from-literal=password=sampletricentispassword
# Confirm the secret configuration
kubectl get secrets
### === pod === ###
# pod
kubectl apply -f deployment.yaml
# Confirm!
kubectl get pods
### === MySQL pod === ###
# Create MySQL pod
kubectl apply -f postgres-deployment.yaml
# Confirm the pod itself
kubectl get pods
# Check the services
kubectl get services
# OR use : kubectl get services --all-namespaces -o wide