Search

Argocd Multi Source Deploy

EKS_CLUSTER_NAME=<EKS_CLUSTER_NAME> AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query "Account" --output text)
Shell
복사
kubectl create ns argocd
Shell
복사
helm repo add argo https://argoproj.github.io/argo-helm helm repo update argo
Shell
복사
cat <<\EOF> argocd-value.yaml configs: params: server.insecure: true EOF
Shell
복사
helm install argocd argo/argo-cd \ --create-namespace \ --namespace argocd \ --values argocd-value.yaml
Shell
복사
sudo curl --silent --location -o /usr/local/bin/argocd https://github.com/argoproj/argo-cd/releases/download/v2.13.1/argocd-linux-amd64 sudo chmod 755 /usr/local/bin/argocd
Shell
복사
sudo dnf install -y expect kubectl port-forward svc/argocd-server -n argocd --address=0.0.0.0 8080:443 > /dev/null & ARGO_PW=(`kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d`) echo y | argocd login --insecure --username admin --password $ARGO_PW 127.0.0.1:8080 # ID : admin expect -c " spawn argocd account update-password expect -re \".*Enter.*\" send \"$ARGO_PW\r\" expect -re \".*Enter.*\" send \"Skill53##\r\" expect -re \".*Confirm.*\" send \"Skill53##\r\" interact "
Shell
복사
helm repo add eks https://aws.github.io/eks-charts helm repo update eks helm install aws-load-balancer-controller eks/aws-load-balancer-controller \ -n kube-system \ --set clusterName=$EKS_CLUSTER_NAME \ --set serviceAccount.create=false \ --set serviceAccount.name=aws-load-balancer-controller
Shell
복사
eksctl utils associate-iam-oidc-provider --region ap-northeast-2 --cluster $EKS_CLUSTER_NAME --approve
Shell
복사
eksctl create iamserviceaccount \ --name ebs-csi-controller-sa \ --region ap-northeast-2 \ --namespace kube-system \ --cluster $EKS_CLUSTER_NAME \ --role-name AmazonEKS_EBS_CSI_DriverRole \ --role-only \ --attach-policy-arn arn:aws:iam::aws:policy/service-role/AmazonEBSCSIDriverPolicy \ --approve
Shell
복사
eksctl create addon --name aws-ebs-csi-driver --cluster $EKS_CLUSTER_NAME --service-account-role-arn arn:aws:iam::$AWS_ACCOUNT_ID:role/AmazonEKS_EBS_CSI_DriverRole
Shell
복사
public_a=$(aws ec2 describe-subnets --filters "Name=tag:Name,Values=skills-public-subnet-a" --query "Subnets[].SubnetId[]" --region ap-northeast-2 --output text) public_b=$(aws ec2 describe-subnets --filters "Name=tag:Name,Values=skills-public-subnet-b" --query "Subnets[].SubnetId[]" --region ap-northeast-2 --output text) private_a=$(aws ec2 describe-subnets --filters "Name=tag:Name,Values=skills-private-subnet-a" --query "Subnets[].SubnetId[]" --region ap-northeast-2 --output text) private_b=$(aws ec2 describe-subnets --filters "Name=tag:Name,Values=skills-private-subnet-b" --query "Subnets[].SubnetId[]" --region ap-northeast-2 --output text) public_subnet_name=("$public_a" "$public_b") private_subnet_name=("$private_a" "$private_b") for name in "${public_subnet_name[@]}" do aws ec2 create-tags --resources $name --tags Key=kubernetes.io/role/elb,Value=1 done for name in "${private_subnet_name[@]}" do aws ec2 create-tags --resources $name --tags Key=kubernetes.io/role/internal-elb,Value=1 done
Shell
복사
apiVersion: argoproj.io/v1alpha1 kind: Application metadata: name: prometheus-deploy namespace: argocd spec: destination: namespace: prometheus server: https://kubernetes.default.svc sources: - path: '' repoURL: https://prometheus-community.github.io/helm-charts targetRevision: 27.20.0 chart: prometheus helm: values: | alertmanager: persistence: storageClass: "gp2" server: persistentVolume: storageClass: "gp2" - path: app repoURL: https://github.com/wlstmd/prometheus-ingress targetRevision: HEAD project: default syncPolicy: syncOptions: - CreateNamespace=true automated: prune: true selfHeal: true
YAML
복사
kubectl apply -f application.yaml
Shell
복사