Last active
September 19, 2023 11:14
-
-
Save AlperRehaYAZGAN/6b8c3507f2ac905bdfab0373b289787e to your computer and use it in GitHub Desktop.
Argocd CLI setup sh code.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kubectl create serviceaccount argocd-master | |
echo ' | |
apiVersion: rbac.authorization.k8s.io/v1 | |
kind: ClusterRole | |
metadata: | |
name: argocd-master | |
rules: | |
- apiGroups: [""] | |
resources: ["pods", "services", "configmaps", "secrets"] | |
verbs: ["get", "list", "watch", "create", "update", "delete"] | |
# Add more permissions as needed | |
--- | |
apiVersion: rbac.authorization.k8s.io/v1 | |
kind: ClusterRoleBinding | |
metadata: | |
name: argocd-master-binding | |
roleRef: | |
apiGroup: rbac.authorization.k8s.io | |
kind: ClusterRole | |
name: argocd-master | |
subjects: | |
- kind: ServiceAccount | |
name: argocd-master | |
namespace: default # Change the namespace as needed | |
' > /root/argocd.yml | |
kubectl apply -f /root/argocd.yml | |
SECRET_NAME=$(kubectl get serviceaccount argocd-master -o jsonpath='{.secrets[0].name}') | |
TOKEN=$(kubectl get secret $SECRET_NAME -o jsonpath='{.data.token}' | base64 -d) | |
argocd login node1:6443 --username argocd-master --password $TOKEN --insecure --grpc-web | |
alias argocd='argocd --insecure' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment