cluster eksctl put it in cluster.yaml
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
name: basic-cluster
region: us-east-1
nodeGroups:
- name: ng-1
instanceType: t2.medium
minSize: 1
maxSize: 4
desiredCapacity: 1
ssh:
allow: true # will use ~/.ssh/id_rsa.pub as the default ssh key
eksctl create cluster --config-file=cluster.yaml
create policy ALBIngressControllerIAMPolicy
aws iam create-policy \
--policy-name ALBIngressControllerIAMPolicy \
--policy-document https://raw.githubusercontent.com/kubernetes-sigs/aws-alb-ingress-controller/v1.1.4/docs/examples/iam-policy.json
eksctl utils associate-iam-oidc-provider \
--region us-east-1 \
--cluster basic-cluster \
--approve
Attach policy to nodes to create Elb
eksctl create iamserviceaccount \
--region us-east-1 \
--name alb-ingress-controller \
--namespace kube-system \
--cluster basic-cluster \
--attach-policy-arn arn:aws:iam::********:policy/ALBIngressControllerIAMPolicy \
--override-existing-serviceaccounts \
--approve
Install aws-alb-ingress-controller
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/aws-alb-ingress-controller/v1.1.4/docs/examples/rbac-role.yaml
Deploy ALB Ingress Controller
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/aws-alb-ingress-controller/v1.1.4/docs/examples/alb-ingress-controller.yaml
kubectl edit deployment.apps/alb-ingress-controller -n kube-system
spec:
containers:
- args:
- --ingress-class=alb
- --cluster-name=basic-cluster
- --aws-vpc-id=vpc-03468a8157edca5bd
- --aws-region=us-east-1
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/aws-alb-ingress-controller/v1.1.4/docs/examples/2048/2048-namespace.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/aws-alb-ingress-controller/v1.1.4/docs/examples/2048/2048-deployment.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/aws-alb-ingress-controller/v1.1.4/docs/examples/2048/2048-service.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/aws-alb-ingress-controller/v1.1.4/docs/examples/2048/2048-ingress.yaml
kubectl get ingress/2048-ingress -n 2048-game
echo -n 'my-app' | base64
echo -n '39528$vdg7Jb' | base64
apiVersion: v1
kind: Secret
metadata:
name: test-secret
data:
username: bXktYXBw
password: Mzk1MjgkdmRnN0p
kubectl create secret generic test-secret --from-literal=username='my-app' --from-literal=password='39528$vdg7Jb'
kubectl autoscale deployment php-apache --cpu-percent=50 --min=1 --max=10