Skip to content

Commit 25940a8

Browse files
authored
docs: update access token docs (argoproj#6852)
Signed-off-by: Ariel Simhon <[email protected]>
1 parent c8d273c commit 25940a8

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

docs/access-token.md

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Access Token
22

3+
## Overview
34
If you want to automate tasks with the Argo Server API or CLI, you will need an access token.
45

6+
## Pre-requisites
57
Firstly, create a role with minimal permissions. This example role for jenkins only permission to update and list workflows:
68

79
```sh
@@ -14,15 +16,19 @@ Create a service account for your service:
1416
kubectl create sa jenkins
1517
```
1618

17-
!! TIP
18-
Create a unique service account for each client: (a) you'll be able to correctly secure your workflows and (b) [revoke the token](#token-revocation) without impacting other clients.
19+
### Tip for Tokens Creation
20+
Create a unique service account for each client:
21+
22+
- (a) you'll be able to correctly secure your workflows
23+
- (b) [revoke the token](#token-revocation) without impacting other clients.
1924

2025
Bind the service account to the role (in this case in the `argo` namespace):
2126

2227
```sh
2328
kubectl create rolebinding jenkins --role=jenkins --serviceaccount=argo:jenkins
2429
```
2530

31+
## Token Creation
2632
You now need to get a token:
2733

2834
```sh
@@ -32,6 +38,7 @@ echo $ARGO_TOKEN
3238
Bearer ZXlKaGJHY2lPaUpTVXpJMU5pSXNJbXRwWkNJNkltS...
3339
```
3440

41+
## Token Usage & Test
3542
To use that token with the CLI you need to set `ARGO_SERVER` (see `argo --help`).
3643

3744
Use that token in your API requests, e.g. to list workflows:
@@ -48,6 +55,26 @@ curl https://localhost:2746/api/v1/workflow-templates/argo -H "Authorization: $A
4855
# 403 error
4956
```
5057

58+
## Token Usage - Docker
59+
60+
### Set additional params to initialize Argo settings
61+
62+
ARGO_SERVER="${{HOST}}:443"
63+
KUBECONFIG=/dev/null
64+
ARGO_NAMESPACE=sandbox
65+
66+
### Start container with settings above
67+
> Note: Example for getting list of templates from an existing namespace
68+
69+
docker run --rm -it \
70+
-e ARGO_SERVER=$ARGO_SERVER \
71+
-e ARGO_TOKEN=$ARGO_TOKEN \
72+
-e ARGO_HTTP=false \
73+
-e ARGO_HTTP1=true \
74+
-e KUBECONFIG=/dev/null \
75+
-e ARGO_NAMESPACE=$ARGO_NAMESPACE \
76+
argoproj/argocli:latest template list -v -e -k
77+
5178
## Token Revocation
5279

5380
Token compromised?
@@ -57,3 +84,4 @@ kubectl delete secret $SECRET
5784
```
5885

5986
A new one will be created.
87+

0 commit comments

Comments
 (0)