-
Notifications
You must be signed in to change notification settings - Fork 21
/
csi-enable.sh
executable file
·28 lines (23 loc) · 2.08 KB
/
csi-enable.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
echo '-------Enable CSI on an EKS Cluster'
export my_eks_cluster=$(eksctl get clusters | grep -v NAME | grep eks4yong1 | awk '{print $1}' | tail -1)
eksctl utils associate-iam-oidc-provider --cluster $my_eks_cluster --approve --region $AWS_REGION
# aws iam detach-role-policy --role-name AmazonEKS_EBS_CSI_DriverRole --policy-arn arn:aws:iam::aws:policy/service-role/AmazonEBSCSIDriverPolicy
# aws iam delete-role --role-name AmazonEKS_EBS_CSI_DriverRole
eksctl create iamserviceaccount \
--name ebs-csi-controller-sa \
--namespace kube-system \
--cluster $my_eks_cluster \
--attach-policy-arn arn:aws:iam::aws:policy/service-role/AmazonEBSCSIDriverPolicy \
--approve \
--role-only \
--role-name Yong-AmazonEKS_EBS_CSI_DriverRole
myaccount_id=$(aws sts get-caller-identity --query "Account" | sed -e 's/\"//g')
eksctl create addon --name aws-ebs-csi-driver --cluster $my_eks_cluster --service-account-role-arn arn:aws:iam::$myaccount_id:role/Yong-AmazonEKS_EBS_CSI_DriverRole --force
kubectl create -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/master/client/config/crd/snapshot.storage.k8s.io_volumesnapshotclasses.yaml
kubectl create -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/master/client/config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml
kubectl create -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/master/client/config/crd/snapshot.storage.k8s.io_volumesnapshots.yaml
kubectl create -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/master/deploy/kubernetes/snapshot-controller/rbac-snapshot-controller.yaml
kubectl create -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/master/deploy/kubernetes/snapshot-controller/setup-snapshot-controller.yaml
kubectl create -f https://raw.githubusercontent.com/kubernetes-sigs/aws-ebs-csi-driver/master/examples/kubernetes/dynamic-provisioning/manifests/storageclass.yaml
kubectl annotate sc gp2 storageclass.kubernetes.io/is-default-class-
kubectl annotate sc ebs-sc storageclass.kubernetes.io/is-default-class=true