github.com/argoproj/argo-cd@v1.8.7/docs/getting_started.md (about)

     1  # Getting Started
     2  
     3  !!! tip
     4      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.
     5  
     6  ## Requirements
     7  
     8  * Installed [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) command-line tool
     9  * Have a [kubeconfig](https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/) file (default location is `~/.kube/config`).
    10  
    11  ## 1. Install Argo CD
    12  
    13  ```bash
    14  kubectl create namespace argocd
    15  kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
    16  ```
    17  
    18  This will create a new namespace, `argocd`, where Argo CD services and application resources will live.
    19  
    20  !!! note
    21      If you are not interested in UI, SSO, multi-cluster management and just want to pull changes into the cluster then you can disable
    22      authentication using `--disable-auth` flag and access Argo CD via CLI using `--port-forward` or `--port-forward-namespace` flags
    23      and proceed to step [#6](#6-create-an-application-from-a-git-repository):
    24      
    25      `kubectl patch deploy argocd-server -n argocd -p '[{"op": "add", "path": "/spec/template/spec/containers/0/command/-", "value": "--disable-auth"}]' --type json`
    26  
    27  ## 2. Download Argo CD CLI
    28  
    29  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).
    30  
    31  Also available in Mac Homebrew:
    32  
    33  ```bash
    34  brew install argocd
    35  ```
    36  
    37  ## 3. Access The Argo CD API Server
    38  
    39  By default, the Argo CD API server is not exposed with an external IP. To access the API server,
    40  choose one of the following techniques to expose the Argo CD API server:
    41  
    42  ### Service Type Load Balancer
    43  Change the argocd-server service type to `LoadBalancer`:
    44  
    45  ```bash
    46  kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "LoadBalancer"}}'
    47  ```
    48  
    49  ### Ingress
    50  Follow the [ingress documentation](operator-manual/ingress.md) on how to configure Argo CD with ingress.
    51  
    52  ### Port Forwarding
    53  Kubectl port-forwarding can also be used to connect to the API server without exposing the service.
    54  
    55  ```bash
    56  kubectl port-forward svc/argocd-server -n argocd 8080:443
    57  ```
    58  
    59  The API server can then be accessed using the localhost:8080
    60  
    61  
    62  ## 4. Login Using The CLI
    63  
    64  The initial password is autogenerated to be the pod name of the
    65  Argo CD API server. This can be retrieved with the command:
    66  
    67  ```bash
    68  kubectl get pods -n argocd -l app.kubernetes.io/name=argocd-server -o name | cut -d'/' -f 2
    69  ```
    70  
    71  Using the username `admin` and the password from above, login to Argo CD's IP or hostname:
    72  
    73  ```bash
    74  argocd login <ARGOCD_SERVER>
    75  ```
    76  
    77  Change the password using the command:
    78  
    79  ```bash
    80  argocd account update-password
    81  ```
    82  
    83  !!! note
    84      The initial password is set in a kubernetes secret, named `argocd-secret`, during ArgoCD's initial start up. This means if you edit
    85      the deployment in any way which causes a new pod to be deployed, such as disabling TLS on the Argo CD API server. Take note of the initial
    86      pod name when you first install Argo CD, or reset the password by following [these instructions](https://argoproj.github.io/argo-cd/faq/#i-forgot-the-admin-password-how-do-i-reset-it)
    87  
    88  ## 5. Register A Cluster To Deploy Apps To (Optional)
    89  
    90  This step registers a cluster's credentials to Argo CD, and is only necessary when deploying to
    91  an external cluster. When deploying internally (to the same cluster that Argo CD is running in),
    92  https://kubernetes.default.svc should be used as the application's K8s API server address.
    93  
    94  First list all clusters contexts in your current kubeconfig:
    95  ```bash
    96  argocd cluster add
    97  ```
    98  
    99  Choose a context name from the list and supply it to `argocd cluster add CONTEXTNAME`. For example,
   100  for docker-desktop context, run:
   101  ```bash
   102  argocd cluster add docker-desktop
   103  ```
   104  
   105  The above command installs a ServiceAccount (`argocd-manager`), into the kube-system namespace of 
   106  that kubectl context, and binds the service account to an admin-level ClusterRole. Argo CD uses this
   107  service account token to perform its management tasks (i.e. deploy/monitoring).
   108  
   109  !!! note
   110      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. 
   111      However `get`, `list`, `watch` privileges are required at the cluster-scope for Argo CD to function.
   112  
   113  ## 6. Create An Application From A Git Repository
   114  
   115  An example repository containing a guestbook application is available at
   116  [https://github.com/argoproj/argocd-example-apps.git](https://github.com/argoproj/argocd-example-apps.git) to demonstrate how Argo CD works.
   117  
   118  ### Creating Apps Via CLI
   119  
   120  !!! note
   121      You can access Argo CD using port forwarding: add `--port-forward-namespace argocd` flag to every CLI command or set `ARGOCD_OPTS` environment variable: `export ARGOCD_OPTS='--port-forward-namespace argocd'`:
   122  
   123      `argocd app create guestbook --repo https://github.com/argoproj/argocd-example-apps.git --path guestbook --dest-server https://kubernetes.default.svc --dest-namespace default`
   124  
   125  ### Creating Apps Via UI
   126  
   127  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.
   128  
   129  After logging in, click the **+ New App** button as shown below:
   130  
   131  ![+ new app button](assets/new-app.png)
   132  
   133  Give your app the name `guestbook`, use the project `default`, and leave the sync policy as `Manual`:
   134  
   135  ![app information](assets/app-ui-information.png)
   136  
   137  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`:
   138  
   139  ![connect repo](assets/connect-repo.png)
   140  
   141  For **Destination**, set cluster to `in-cluster` and namespace to `default`:
   142  
   143  ![destination](assets/destination.png)
   144  
   145  After filling out the information above, click **Create** at the top of the UI to create the `guestbook` application:
   146  
   147  ![destination](assets/create-app.png)
   148  
   149  
   150  ## 7. Sync (Deploy) The Application
   151  
   152  Once the guestbook application is created, you can now view its status:
   153  
   154  ```bash
   155  $ argocd app get guestbook
   156  Name:               guestbook
   157  Server:             https://kubernetes.default.svc
   158  Namespace:          default
   159  URL:                https://10.97.164.88/applications/guestbook
   160  Repo:               https://github.com/argoproj/argocd-example-apps.git
   161  Target:
   162  Path:               guestbook
   163  Sync Policy:        <none>
   164  Sync Status:        OutOfSync from  (1ff8a67)
   165  Health Status:      Missing
   166  
   167  GROUP  KIND        NAMESPACE  NAME          STATUS     HEALTH
   168  apps   Deployment  default    guestbook-ui  OutOfSync  Missing
   169         Service     default    guestbook-ui  OutOfSync  Missing
   170  ```
   171  
   172  The application status is initially in `OutOfSync` state since the application has yet to be
   173  deployed, and no Kubernetes resources have been created. To sync (deploy) the application, run:
   174  
   175  ```bash
   176  argocd app sync guestbook
   177  ```
   178  
   179  This command retrieves the manifests from the repository and performs a `kubectl apply` of the
   180  manifests. The guestbook app is now running and you can now view its resource components, logs,
   181  events, and assessed health status:
   182  
   183  ### From UI:
   184  
   185  ![guestbook app](assets/guestbook-app.png)
   186  ![view app](assets/guestbook-tree.png)
   187