During installation Direktiv creates an admin token to access the API. This token can be used to run "admin" only commands. One of the commands is e.g. creating a namespace.
The first step is to get the admin token from the system. During the installation Direktiv creates a secret with the token. It is called adminsecret and the secret value is adminsecret. Run the following command to retrieve the token:
kubectl get secrets adminsecret -o 'go-template={% raw %}{{ index .data "adminsecret" }}'{% endraw %} | base64 --decode
This return the secret token in plain-text and can be used in as a HTTP header to execute commands. An example token could be aF2iVXeDX1QxNDARVDL7K2YQ8YLsvxHu.
This token can be used as Direktiv-Token header in API requests via cUrl or other tools like Insomnia or Postman.
The following cUrl command would create a namespace.
curl -X PUT -H "Direktiv-Token: aF2iVXeDX1QxNDARVDL7K2YQ8YLsvxHu" https://my-direktiv-server/api/namespaces/testme
If he server uses a self-signed certificate add -k as a cUrl parameter.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article