Skip to content

OCPBUGS-54613: Added acessing to kubeconfig using oc CLI module #95219

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

subhtk
Copy link
Contributor

@subhtk subhtk commented Jun 25, 2025

@openshift-ci openshift-ci bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jun 25, 2025
@subhtk subhtk force-pushed the 54613 branch 4 times, most recently from 483a34d to 3d19364 Compare June 27, 2025 11:40
@subhtk subhtk force-pushed the 54613 branch 2 times, most recently from 8571043 to dce3a09 Compare June 27, 2025 11:55
@subhtk subhtk force-pushed the 54613 branch 2 times, most recently from b7fa6cd to aae6e60 Compare June 27, 2025 12:05
Copy link

openshift-ci bot commented Jun 27, 2025

@subhtk: all tests passed!

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@sairameshv
Copy link
Member

/retitle OCPBUGS-54613: Added acessing to kubeconfig using oc CLI module

@openshift-ci openshift-ci bot changed the title OCPBUGS#54613: Added acessing to kubeconfig using oc CLI module OCPBUGS-54613: Added acessing to kubeconfig using oc CLI module Jun 27, 2025
@openshift-ci-robot openshift-ci-robot added jira/severity-important Referenced Jira bug's severity is important for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Jun 27, 2025
@openshift-ci-robot
Copy link

@subhtk: This pull request references Jira Issue OCPBUGS-54613, which is invalid:

  • expected the bug to target the "4.20.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

In response to this:

Version(s): 4.18+

Issue: https://issues.redhat.com/browse/OCPBUGS-54613

Link to docs preview: https://95219--ocpdocs-pr.netlify.app/openshift-enterprise/latest/cli_reference/openshift_cli/configuring-cli.html#cli-accessing-cli

QE review:

  • QE has approved this change.

Additional information:

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@sairameshv
Copy link
Member

/jira refresh

@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Jun 27, 2025
@openshift-ci-robot
Copy link

@sairameshv: This pull request references Jira Issue OCPBUGS-54613, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.20.0) matches configured target version for branch (4.20.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)

In response to this:

/jira refresh

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

Copy link
Member

@sairameshv sairameshv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, I have reviewed the changes as requested.
I would also suggest to request one more round of a review from the docs team as well.

@@ -16,3 +16,10 @@ include::modules/cli-configuring-completion.adoc[leveloffset=+2]

// Enabling tab completion for Zsh
include::modules/cli-configuring-completion-zsh.adoc[leveloffset=+2]

[id="cli-configuring-kubeconfig_{context}"]
== Configuring a kubeconfig file by using the oc CLI
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
== Configuring a kubeconfig file by using the oc CLI
== Retrieving and managing `kubeconfig` data by using the openshift client i.e. `oc`

or

Suggested change
== Configuring a kubeconfig file by using the oc CLI
Generating a kubeconfig file by logging in with the oc CLI

Could you re-word it (similar to the suggestion) as we do not configure the kubeconfig file?

[id="cli-configuring-kubeconfig_{context}"]
== Configuring a kubeconfig file by using the oc CLI

You can use the `oc` Command-Line Interface (CLI) to log in to your OpenShift cluster and retrieve the `kubeconfig` file. The `kubeconfig` file contains the configuration information required to interact with the cluster using CLI tools such as `kubectl` or `oc`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
You can use the `oc` Command-Line Interface (CLI) to log in to your OpenShift cluster and retrieve the `kubeconfig` file. The `kubeconfig` file contains the configuration information required to interact with the cluster using CLI tools such as `kubectl` or `oc`.
You can use the oc command-line interface (CLI) to log in to your OpenShift cluster and generate or update a kubeconfig file. This file contains the configuration details—such as cluster, user credentials, and context—required to interact with the cluster using CLI tools like oc or kubectl.

[id="cli-accessing-kubeconfig-using-cli_{context}"]
= Accessing `kubeconfig` using the `oc` CLI

You can use the `oc` CLI to log in to your OpenShift cluster and retrieve a kubeconfig file for accessing the cluster from the command line.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
You can use the `oc` CLI to log in to your OpenShift cluster and retrieve a kubeconfig file for accessing the cluster from the command line.
Use the `oc` command-line interface (CLI) to log in to your OpenShift cluster and generate a `kubeconfig` file. This file enables command-line access to the cluster with tools such as `oc` or `kubectl`.


.Prerequisites

* You have access to the {product-title} web console or API server endpoint.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* You have access to the {product-title} web console or API server endpoint.
* You have a valid user credentials to access the {product-title} web console or API server endpoint.

$ oc login <api-server-url> -u <username> -p <password> <1>
----
+
<1> Replace `<api-server-url>` with the full API server URL, such as `https://api.my-cluster.example.com:6443`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also mention/give an example of <username> and <password> as well?

$ export KUBECONFIG=./kubeconfig
----

. You can now use `kubectl` to interact with your OpenShift cluster by running the following command:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
. You can now use `kubectl` to interact with your OpenShift cluster by running the following command:
. You can now use `kubectl` or `oc` to interact with your OpenShift cluster

+
<1> Replace `<api-server-url>` with the full API server URL, such as `https://api.my-cluster.example.com:6443`.

. Save the cluster configuration to a local file by running the following command:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think by running the following command need not be repeated on all the steps

Suggested change
. Save the cluster configuration to a local file by running the following command:
. Save the cluster configuration to a local file

$ oc config view --raw > kubeconfig
----

. Set the `KUBECONFIG` environment variable to point to the exported file by running the following command:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
. Set the `KUBECONFIG` environment variable to point to the exported file by running the following command:
. Set the `KUBECONFIG` environment variable to point to the exported file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
jira/severity-important Referenced Jira bug's severity is important for the branch this PR is targeting. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants