kubernetesargo-workflows

Argo HTTP workflow - failed to get token volumes: service account argo/default does not have any secrets


I am new to Argo and following the Quickstart templates and would like to deploy the HTTP template as a workflow.

I create my cluster as so:

minikube start --driver=docker --cpus='2' --memory='8g'
kubectl create ns argo
kubectl apply -n argo -f https://raw.githubusercontent.com/argoproj/argo-workflows/master/manifests/quick-start-postgres.yaml

I then apply the HTTP template http_template.yaml from the docs:

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: http-template-
spec:
  entrypoint: main
  templates:
    - name: main
      steps:
        - - name: get-google-homepage
            template: http
            arguments:
              parameters: [ { name: url, value: "https://www.google.com" } ]
    - name: http
      inputs:
        parameters:
          - name: url
      http:
        timeoutSeconds: 20 # Default 30
        url: "{{inputs.parameters.url}}"
        method: "GET" # Default GET
        headers:
          - name: "x-header-name"
            value: "test-value"
        # Template will succeed if evaluated to true, otherwise will fail
        # Available variables:
        #  request.body: string, the request body
        #  request.headers: map[string][]string, the request headers
        #  response.url: string, the request url
        #  response.method: string, the request method
        #  response.statusCode: int, the response status code
        #  response.body: string, the response body
        #  response.headers: map[string][]string, the response headers
        successCondition: "response.body contains \"google\"" # available since v3.3
        body: "test body" # Change request body

argo submit -n argo http_template.yaml --watch

However I get the the following error:

Name:                http-template-564qp
Namespace:           argo
ServiceAccount:      unset (will run with the default ServiceAccount)
Status:              Error
Message:             failed to get token volumes: service account argo/default does not have any secrets

I'm not clear on why this doesn't work given it's straight from the Quickstart documentation. Help would be appreciated.


Solution

  • It seems your default serviceaccount is missing a credential (kubernetes secret)

    You can verify the existence of the credential by checking which one it needs by running kubectl get serviceaccount -n default default -o yaml

    kubectl get serviceaccount -n default default -o yaml
    apiVersion: v1
    kind: ServiceAccount
    metadata:
      creationTimestamp: "2022-02-10T10:48:54Z"
      name: default
      namespace: default
      resourceVersion: "*******"
      uid: ********************
    secrets:
    - name: default-token-*****
    

    Now you should be able to find the secret which is attached to the serviceaccount

    kubectl get secret -n default default-token-***** -o yaml

    Or you can just run

    kubectl get secret -n default

    To see all secrets in the respective namespace (in this example, default)