0

i have a system which is running swagger-ui for testing REST queries and minikube for managing the containers of different query services. Now when i execute a POST request on swagger it throws this error:

  "timestamp": "2019-07-10T06:53:47.639+0000",
  "status": 500,
  "error": "Internal Server Error",
  "message": "Failure executing: POST at: https://10.96.0.1/apis/batch/v1/namespaces/default/jobs. Message: Forbidden!Configured service account doesn't have access. Service account may have been revoked. jobs.batch is forbidden: User \"system:serviceaccount:default:default\" cannot create resource \"jobs\" in API group \"batch\" in the namespace \"default\".",
  "path": "/workflows"
}

i have tried creating a role by the name of jobs in minikube dashboard but that did not work. i guess i have to define a service account with certain roles but i am unaware of it as i am naive to the domain of kubernetes. my query services include GET,POST,DELETE.

Here is how my POST query looks like :

{
  "jobs": [
    {
      "container": {
        "args": [
          "string"
        ],
        "command": "string",
        "image": "ingestion",
        "properties": {
          "scihub_username": "username",
          "scihub_password": "password",
          "producttype": "S2MSI2A",
          "platformname": "Sentinel-2",
          "footprint":"POLYGON((5.8664000 50.3276000,9.4623000 50.3276000,9.4623000 52.5325000,5.8664000 52.5325000,5.8664000 50.3276000))",
          "days_back": 7
        },
        "volumes": [
          {
            "mountPath": "/out_data",
            "name": "workspace"
          }
        ]
      },
      "jobName": "ingestion"
    }
  ],
  "workflowName": "ingestion_and_preprocessing"
}

How can i fix this error to properly execute the query?

rehan
  • 143
  • 3
  • 17
  • Are you hitting an Kubernetes API endpoint (`https://10.96.0.1/apis/batch/v1/namespaces/default/jobs`) with an unauthorized POST request to create a resource? Can you give more details on how are you trying to manage the containers inside the cluster? – yyyyahir Jul 10 '19 at 15:27
  • @YahirHernández so i was able to solve this issue by creating persistent volumes and volume claims by using the default configurations as defined in kubernetes documentation but now i am having another problem that whenver i execute the query, it startes the job but it remains in pending state and the error it shows me is that `unable to mount volume for the pod`. Do i need to manually configure PVC for the pod as well? – Rehan Jul 11 '19 at 16:08
  • It only means that the volume isn't mounting. Share your PV and PVC configurations to determine that. Also, share details on where are your running this (Minikube, AKS, GKE, bare metal, etc.). – yyyyahir Jul 11 '19 at 16:48
  • @YahirHernández you can find the configurations [here](https://stackoverflow.com/questions/56973155/volumen-not-mounting-for-pod-in-minikube-after-the-creation-of-pv-and-pvc) . and i have mentioned it in both questions that i am running it on Minikube – rehan Jul 12 '19 at 06:19

1 Answers1

0

I hit this error when I had an empty kubectl config file...

Chris Stryczynski
  • 30,145
  • 48
  • 175
  • 286