Access argocd through https://cd.test.cn/. The default local username is admin and the password is the name of one of the pods. To get the password, use the following method:
# kubectl get pods -n argocd -l app.kubernetes.io/name=argocd-server -o name | cut -d'/' -f 2
User management
argocd uses local users by default and supports ldap. Local user management uses the configmap method of modifying argocd-cm. Add new users as follows:
apiVersion:v1kind:ConfigMapmetadata:annotations:labels:app.kubernetes.io/name:argocd-cmapp.kubernetes.io/part-of:argocdname:argocd-cmnamespace:argocddata:accounts.chlai:apiKey,login#Allow users to login and generate aipkeyusers.anonymous.enabled:"true"#Allow anonymous users to log in.
Save and modify to take effect immediately.
The default roles of the system are readonly and admin. To grant the user admin permissions, modify the argocd-rbac-cm configmap:
apiVersion:v1kind:ConfigMapmetadata:labels:app.kubernetes.io/name:argocd-rbac-cmapp.kubernetes.io/part-of:argocdname:argocd-rbac-cmnamespace:argocddata:policy.csv:|-g, chlai, role:adminpolicy.default:role:readonly#Anonymous login uses the readonly role by default.
To generate a login password, you need to use the admin user cli method to log in to the server and modify it through the argocd account update-password command:
Log in to the argocd web ui using the new user password.
ArgoCD UI interface to create an application
Click the “+ NEW APP” button to create an application;
Fill in the application name: guestbook; project: default; synchronization strategy: manual;
Configure the source. Here, Git is configured, and the URL of the code repository is configured as the project address on Github is: https://github.com/argoproj/argocd-example-apps.git; Revision selection: HEAD; Project path selection: guestbook;
Select the target cluster for application deployment: https://kubernetes.default.svc, because this time Argo CD is deployed in the Kubernetes cluster, by default Argo CD has already added the current Kubernetes cluster for us, so we can use it directly. Namespace selection: my-app. Namespcae can be created using the # kubectl create namespace my-app command on the Kubernetes cluster;
After filling in, click the “CREATE” button to create;
Since the application has not been deployed and the Kubernetes resources have not been created, the Status is still OutOfSync, so we also need to click the “SYNC” button to synchronize (deploy). You can also install the argocd client and use the Argo CD CLI to synchronize
:# argocd app sync guestbook
The application is created and is in the “unsynchronized” state. Manually synchronize the application and start deploying the application