From f199ea1ab73113eefb79dcd82038e47e17d123c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Pab=C3=B3n?= Date: Fri, 9 Aug 2019 23:20:39 -0400 Subject: [PATCH] save --- README.md | 27 ++++++++++++++++----------- cmd/contextCreate.go | 13 ++++++++++--- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 71fd7331..db9e5e1a 100644 --- a/README.md +++ b/README.md @@ -17,15 +17,6 @@ Orchestration systems like Kubernetes. To use this tool you must first create a context with the appropriate information. `px` uses the context to connect to the appropriate Portworx cluster to execute the requested command. -## Installing as a kubectl plugin -Install `px` binary anywhere in your PATH and name it `kubectl-px`. You will -then be able to run it like this: - -``` -$ kubectl px get nodes -$ kubectl px get pvc -``` - ## Creating a context You can create a context using the following command: @@ -37,6 +28,11 @@ See `px context create --help` for more information like setting the Kubeconfig. > NOTE: The default gRPC SDK port for Portworx is 9020 +### Connecting to Portworx running on a Kuberentes Cloud +If you are running Portworx installed on a Kubernetes Cloud like GKE, EKS, etc, +you may need to use the workaround in issue #40 to access the Portworx gRPC +endpoint through the Kubernetes API. + ### What if you don't have a Portworx cluster? `px` uses the [OpenStorage SDK](https://libopenstorage.github.io) to communicate with Portworx, therefore it is fully compatible with OpenStorage's @@ -48,11 +44,20 @@ $ docker run --rm --name sdk -d -p 9100:9100 -p 9110:9110 openstorage/mock-sdk-s $ px context create --name=mycluster --endpoint=localhost:9100 ``` -## Status +## Installing as a kubectl plugin +Install `px` binary anywhere in your PATH and name it `kubectl-px`. You will +then be able to run it like this: + +``` +$ kubectl px get nodes +$ kubectl px get pvc +``` + +## px sample commands Now that `px` has been setup with a context, you can do the following commands: ``` -$ px status +$ px describe cluster $ px get volume $ px get volume -o wide $ px get nodes diff --git a/cmd/contextCreate.go b/cmd/contextCreate.go index 046c1fe6..b278493a 100644 --- a/cmd/contextCreate.go +++ b/cmd/contextCreate.go @@ -30,9 +30,16 @@ var contextCreateCmd *cobra.Command var _ = RegisterCommandVar(func() { // contextCreateCmd represents the contextCreate command contextCreateCmd = &cobra.Command{ - Use: "create [NAME]", - Short: "Create a context", - Example: "$ px context create mycluster --endpoint=123.456.1.10:9020", + Use: "create [NAME]", + Short: "Create a context", + Example: ` + # To create a context called k8s which will communicate to a Kubernetes + # cluster and to one of the nodes running Portworx: + px context create mycluster --kubeconfig=/path/to/kubeconfig --endpoint=123.456.1.10:9020 + + # To create a context called mycluster which will point to one of the Portworx + # nodes on the cluster: + px context create mycluster --endpoint=123.456.1.10:9020`, Args: func(cmd *cobra.Command, args []string) error { if len(args) < 1 { return fmt.Errorf("Must supply a name for context")