2019-04-05 22:12:27 +00:00
# Getting Started
!!! tip
2019-12-04 01:33:11 +00:00
This guide assumes you have a grounding in the tools that Argo CD is based on. Please read [understanding the basics ](understand_the_basics.md ) to learn about these tools.
2018-03-09 00:05:16 +00:00
## Requirements
2019-04-05 22:12:27 +00:00
2020-12-16 15:23:44 +00:00
* Installed [kubectl ](https://kubernetes.io/docs/tasks/tools/install-kubectl/ ) command-line tool.
2018-03-09 00:05:16 +00:00
* Have a [kubeconfig ](https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/ ) file (default location is `~/.kube/config` ).
2022-03-19 14:15:38 +00:00
* CoreDNS. Can be enabled for microk8s by `microk8s enable dns && microk8s stop && microk8s start`
2018-03-09 00:05:16 +00:00
2018-11-05 19:29:01 +00:00
## 1. Install Argo CD
2019-04-05 22:12:27 +00:00
2018-09-05 05:31:21 +00:00
```bash
2018-07-17 07:38:37 +00:00
kubectl create namespace argocd
2019-01-11 04:56:04 +00:00
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
2018-04-23 09:40:13 +00:00
```
2019-04-05 22:12:27 +00:00
This will create a new namespace, `argocd` , where Argo CD services and application resources will live.
2019-01-11 04:56:04 +00:00
2021-06-08 22:31:44 +00:00
!!! warning
2021-12-17 19:47:55 +00:00
The installation manifests include `ClusterRoleBinding` resources that reference `argocd` namespace. If you are installing Argo CD into a different
2021-06-08 22:31:44 +00:00
namespace then make sure to update the namespace reference.
2021-07-27 23:36:13 +00:00
If you are not interested in UI, SSO, multi-cluster features then you can install [core ](operator-manual/installation.md#core ) Argo CD components only:
2021-07-21 04:51:36 +00:00
```bash
kubectl create namespace argocd
2021-07-27 23:36:13 +00:00
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/core-install.yaml
2021-07-21 04:51:36 +00:00
```
2022-06-28 13:00:45 +00:00
This default installation will have a self-signed certificate and cannot be accessed without a bit of extra work.
Do one of:
2022-07-05 18:04:29 +00:00
2022-09-29 08:08:44 +00:00
* Follow the [instructions to configure a certificate ](operator-manual/tls.md ) (and ensure that the client OS trusts it).
2022-06-28 13:00:45 +00:00
* Configure the client OS to trust the self signed certificate.
* Use the --insecure flag on all Argo CD CLI operations in this guide.
2021-07-28 23:30:11 +00:00
Use `argocd login --core` to [configure ](./user-guide/commands/argocd_login.md ) CLI access and skip steps 3-5.
2020-01-03 01:54:06 +00:00
2018-11-05 19:29:01 +00:00
## 2. Download Argo CD CLI
2018-03-09 00:05:16 +00:00
2019-12-09 16:36:33 +00:00
Download the latest Argo CD version from [https://github.com/argoproj/argo-cd/releases/latest ](https://github.com/argoproj/argo-cd/releases/latest ). More detailed installation instructions can be found via the [CLI installation documentation ](cli_installation.md ).
2018-07-30 23:13:54 +00:00
2021-05-24 16:42:32 +00:00
Also available in Mac, Linux and WSL Homebrew:
2019-04-05 22:12:27 +00:00
2018-09-05 05:31:21 +00:00
```bash
2020-09-03 21:44:55 +00:00
brew install argocd
2018-07-30 23:13:54 +00:00
```
2019-04-05 22:12:27 +00:00
## 3. Access The Argo CD API Server
2018-03-09 00:05:16 +00:00
2018-11-05 19:29:01 +00:00
By default, the Argo CD API server is not exposed with an external IP. To access the API server,
2019-01-11 04:56:04 +00:00
choose one of the following techniques to expose the Argo CD API server:
2018-09-25 15:01:41 +00:00
2019-04-05 22:12:27 +00:00
### Service Type Load Balancer
2018-09-25 15:01:41 +00:00
Change the argocd-server service type to `LoadBalancer` :
2018-03-09 00:05:16 +00:00
2018-09-05 05:31:21 +00:00
```bash
2018-04-23 09:40:13 +00:00
kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "LoadBalancer"}}'
2018-03-09 00:05:16 +00:00
```
2018-09-26 14:40:42 +00:00
### Ingress
2019-04-05 22:12:27 +00:00
Follow the [ingress documentation ](operator-manual/ingress.md ) on how to configure Argo CD with ingress.
2018-09-25 15:01:41 +00:00
### Port Forwarding
2019-01-11 04:56:04 +00:00
Kubectl port-forwarding can also be used to connect to the API server without exposing the service.
```bash
2019-02-09 01:15:33 +00:00
kubectl port-forward svc/argocd-server -n argocd 8080:443
2019-01-11 04:56:04 +00:00
```
2019-04-05 22:12:27 +00:00
2022-02-22 21:33:58 +00:00
The API server can then be accessed using https://localhost:8080
2018-09-05 05:31:21 +00:00
2019-04-05 22:12:27 +00:00
## 4. Login Using The CLI
2018-03-09 00:05:16 +00:00
2021-01-06 09:44:37 +00:00
The initial password for the `admin` account is auto-generated and stored as
2021-02-17 09:43:20 +00:00
clear text in the field `password` in a secret named `argocd-initial-admin-secret`
2021-01-06 09:44:37 +00:00
in your Argo CD installation namespace. You can simply retrieve this password
2022-11-04 16:57:35 +00:00
using the `argocd` CLI:
2021-01-06 09:44:37 +00:00
```bash
2023-03-06 20:32:02 +00:00
argocd admin initial-password -n argocd
2021-01-06 09:44:37 +00:00
```
2021-06-08 22:31:44 +00:00
!!! warning
You should delete the `argocd-initial-admin-secret` from the Argo CD
namespace once you changed the password. The secret serves no other
purpose than to store the initially generated password in clear and can
safely be deleted at any time. It will be re-created on demand by Argo CD
if a new admin password must be re-generated.
2021-01-06 09:44:37 +00:00
Using the username `admin` and the password from above, login to Argo CD's IP or hostname:
```bash
argocd login < ARGOCD_SERVER >
```
2021-08-25 09:26:44 +00:00
!!! note
2022-03-04 20:09:01 +00:00
The CLI environment must be able to communicate with the Argo CD API server. If it isn't directly accessible as described above in step 3, you can tell the CLI to access it using port forwarding through one of these mechanisms: 1) add `--port-forward-namespace argocd` flag to every CLI command; or 2) set `ARGOCD_OPTS` environment variable: `export ARGOCD_OPTS='--port-forward-namespace argocd'` .
2021-08-25 09:26:44 +00:00
2021-01-06 09:44:37 +00:00
Change the password using the command:
```bash
argocd account update-password
```
2019-04-05 22:12:27 +00:00
## 5. Register A Cluster To Deploy Apps To (Optional)
2018-03-09 00:05:16 +00:00
2018-11-05 19:29:01 +00:00
This step registers a cluster's credentials to Argo CD, and is only necessary when deploying to
an external cluster. When deploying internally (to the same cluster that Argo CD is running in),
2018-09-26 14:40:42 +00:00
https://kubernetes.default.svc should be used as the application's K8s API server address.
2018-09-25 15:01:41 +00:00
2020-09-03 21:03:48 +00:00
First list all clusters contexts in your current kubeconfig:
2018-09-05 05:31:21 +00:00
```bash
2020-12-03 23:26:34 +00:00
kubectl config get-contexts -o name
2018-07-17 07:38:37 +00:00
```
Choose a context name from the list and supply it to `argocd cluster add CONTEXTNAME` . For example,
2020-11-18 16:52:33 +00:00
for docker-desktop context, run:
2018-09-05 05:31:21 +00:00
```bash
2020-11-18 16:52:33 +00:00
argocd cluster add docker-desktop
2018-06-21 01:40:49 +00:00
```
2022-09-29 08:08:44 +00:00
The above command installs a ServiceAccount (`argocd-manager`), into the kube-system namespace of
2019-01-11 04:56:04 +00:00
that kubectl context, and binds the service account to an admin-level ClusterRole. Argo CD uses this
service account token to perform its management tasks (i.e. deploy/monitoring).
2018-07-17 07:38:37 +00:00
2019-04-05 22:12:27 +00:00
!!! note
2022-09-29 08:08:44 +00:00
The rules of the `argocd-manager-role` role can be modified such that it only has `create` , `update` , `patch` , `delete` privileges to a limited set of namespaces, groups, kinds.
2019-04-05 22:12:27 +00:00
However `get` , `list` , `watch` privileges are required at the cluster-scope for Argo CD to function.
2018-06-21 01:40:49 +00:00
2019-04-05 22:12:27 +00:00
## 6. Create An Application From A Git Repository
2018-06-21 01:40:49 +00:00
2019-04-05 22:12:27 +00:00
An example repository containing a guestbook application is available at
2019-09-14 01:05:14 +00:00
[https://github.com/argoproj/argocd-example-apps.git ](https://github.com/argoproj/argocd-example-apps.git ) to demonstrate how Argo CD works.
2019-01-11 04:56:04 +00:00
2019-04-05 22:12:27 +00:00
### Creating Apps Via CLI
2018-06-21 01:40:49 +00:00
2022-09-17 00:22:02 +00:00
First we need to set the current namespace to argocd running the following command:
```bash
kubectl config set-context --current --namespace=argocd
```
2021-08-25 09:26:44 +00:00
Create the example guestbook application with the following command:
2020-01-03 01:54:06 +00:00
2021-08-25 09:26:44 +00:00
```bash
2022-01-18 03:41:04 +00:00
argocd app create guestbook --repo https://github.com/argoproj/argocd-example-apps.git --path guestbook --dest-server https://kubernetes.default.svc --dest-namespace default
2021-08-25 09:26:44 +00:00
```
2019-01-11 04:56:04 +00:00
2019-04-05 22:12:27 +00:00
### Creating Apps Via UI
2018-03-09 00:05:16 +00:00
2019-12-04 01:33:11 +00:00
Open a browser to the Argo CD external UI, and login by visiting the IP/hostname in a browser and use the credentials set in step 4.
2018-06-21 01:40:49 +00:00
2019-12-04 01:33:11 +00:00
After logging in, click the ** + New App** button as shown below:
2018-06-21 01:40:49 +00:00
2019-12-04 01:33:11 +00:00

2018-06-21 01:40:49 +00:00
2019-12-04 01:33:11 +00:00
Give your app the name `guestbook` , use the project `default` , and leave the sync policy as `Manual` :

Connect the [https://github.com/argoproj/argocd-example-apps.git ](https://github.com/argoproj/argocd-example-apps.git ) repo to Argo CD by setting repository url to the github repo url, leave revision as `HEAD` , and set the path to `guestbook` :

2021-08-13 05:23:00 +00:00
For **Destination** , set cluster URL to `https://kubernetes.default.svc` (or `in-cluster` for cluster name) and namespace to `default` :
2019-12-04 01:33:11 +00:00

After filling out the information above, click **Create** at the top of the UI to create the `guestbook` application:

2018-06-21 01:40:49 +00:00
2019-04-05 22:12:27 +00:00
## 7. Sync (Deploy) The Application
2018-06-21 01:40:49 +00:00
2020-12-16 15:23:44 +00:00
### Syncing via CLI
2020-12-03 23:49:30 +00:00
2018-06-21 01:40:49 +00:00
Once the guestbook application is created, you can now view its status:
2018-03-09 00:05:16 +00:00
2018-09-05 05:31:21 +00:00
```bash
2019-01-11 04:56:04 +00:00
$ argocd app get guestbook
Name: guestbook
Server: https://kubernetes.default.svc
Namespace: default
URL: https://10.97.164.88/applications/guestbook
Repo: https://github.com/argoproj/argocd-example-apps.git
Target:
Path: guestbook
Sync Policy: < none >
Sync Status: OutOfSync from (1ff8a67)
Health Status: Missing
GROUP KIND NAMESPACE NAME STATUS HEALTH
apps Deployment default guestbook-ui OutOfSync Missing
Service default guestbook-ui OutOfSync Missing
2018-03-09 00:05:16 +00:00
```
2019-12-04 01:33:11 +00:00
The application status is initially in `OutOfSync` state since the application has yet to be
2018-04-23 09:40:13 +00:00
deployed, and no Kubernetes resources have been created. To sync (deploy) the application, run:
2018-03-09 00:05:16 +00:00
2018-09-05 05:31:21 +00:00
```bash
2019-01-11 04:56:04 +00:00
argocd app sync guestbook
2018-03-09 00:05:16 +00:00
```
2019-04-05 22:12:27 +00:00
This command retrieves the manifests from the repository and performs a `kubectl apply` of the
2018-09-25 15:01:41 +00:00
manifests. The guestbook app is now running and you can now view its resource components, logs,
2020-12-16 15:23:44 +00:00
events, and assessed health status.
2018-03-09 00:05:16 +00:00
2020-12-16 15:23:44 +00:00
### Syncing via UI
2019-04-05 22:12:27 +00:00
2019-01-11 04:56:04 +00:00

2018-06-21 01:40:49 +00:00

2018-03-09 00:05:16 +00:00