Live Optics | Kubernetes | Create a service account for a Red Hat OpenShift environment
Summary: To complete a Live Optics Kubernetes collection, an account with at least read-only access to the API endpoints that Live Optics accesses, must be used. This article describes how to Create a service account, create a role with at least read-only access to the API, bind the role to the service account, and Create a Kubeconfig file for the account intended for the Live Optics collection. ...
Acest articol se aplică pentru
Acest articol nu se aplică pentru
Acest articol nu este legat de un produs specific.
Acest articol nu acoperă toate versiunile de produs existente.
Instructions
Prerequisites
- Download and install the OpenShift CLI (oc). See https://docs.openshift.com/container-platform/4.15/cli_reference/openshift_cli/getting-started-cli.html for more information.
- Download the attached YAML file (liveoptics-read-api-permissions.yaml) located at the end of this article
NOTE: The screenshots used in the article are, for example, purposes only. Ensure use of the correct login credentials, including IP addresses and port numbers for the environment.
- Open a terminal or command prompt and enter the following command to log in to your target cluster.
oc login <cluster-url> (Replace <cluster-url> with the URL of your target cluster). - Enter your username and password when prompted.
- Apply the YAML file attached to this article using the following command:
oc apply -f liveoptics-read-api.yaml
This creates:
- A service account (liveoptics-read-api)
- A token (liveoptics-read-api-token)
- A role (liveoptics-read-api-access)
- A role binding (liveoptics-read-api-binding)
The role created by the YAML file has Get, List, and Watch permissions for the following resources:- Apps/replicasets
- Apps/statefulsets
- Metrics.k8s.io/*
- Nodes
- Nodes/status
- Persistentvolumes
- Persistentvolumeclaims
- Pods
- Storage.k8s.io/*
- Snapshot.storage.k8s.io/*
- Use the following command to retrieve the token data created automatically in Step 3. The name of the token appears in the output of Step 3. In this example, the token name is liveoptics-read-api-token.
oc describe secret <token name>
- Copy the full token text (with no white spaces) and save it for the next step.
- To generate the Kubeconfig file, run the below command. Replace <server name> with your server details, and $TOKEN with the token saved from the previous step. Enter a location for the Kubeconfig file to be saved. In this example, it is /tmp directory.
oc login --server=<server_name> --token=$TOKEN --kubeconfig=/tmp/serviceaccount-kubeconfig
- Browse to your specified location to retrieve the Kubeconfig file. Start the Kubernetes collection using the Live Optics collector. See Complete a Kubernetes collection for more information.
Produse afectate
LiveOpticsAttachments
liveoptics-read-api-permissions_pkb_en_US_1.zip liveoptics-yaml_pkb_en_US_1.zip
Proprietăți articol
Article Number: 000228871
Article Type: How To
Ultima modificare: 07 oct. 2025
Version: 4
Găsiți răspunsuri la întrebările dvs. de la alți utilizatori Dell
Servicii de asistență
Verificați dacă dispozitivul dvs. este acoperit de serviciile de asistență.