Search
Cenz Wong

Ways to interact with Kubernetes Clusters managed by HPE Ezmeral Container Platform

May 28, 2021

Editor’s Note – HPE Ezmeral Container Platform is now HPE Ezmeral Runtime Enterprise. For more information on why the name was changed, please click here.

HPE Ezmeral Software Platform consists of a bundle of software that helps you run, manage, control, and secure the apps, data, and IT that run your business. A major component is the HPE Ezmeral Container Platform (HPE ECP),a unified cloud container software platform built on Kubernetes (K8s). You can use it to deploy a new Kubernetes cluster with a few clicks. But how exactly do you connect through HPE ECP to interact with K8s? Don't panic! This blog post will introduce to you most, if not all, of the ways to connect with a Kubernetes cluster using HPE ECP.

WebUI

The first method by which you can interact with a Kubernetes Clusters managed by HPE ECP is, of course, through the web user interface (WebUI).

Screenshot
Description
In the Main Menu, if you are the administrator of the HPE Ezmeral CP, you can manage and monitor the status of the K8s clusters managed by HPE ECP.
You can access the Kubernetes Dashboard just as you would do with open source Kubernetes.

WebTerminal

Inside the Kubernetes Tenant, at the bottom, there is a web terminal for you to interact with Kubernetes using the kubectl command.

Screenshot
Description
At the bottom, you can click "Initialize" to initiate the web terminal instance.
Type your kubectl command to interact with Kubernetes.

HPE Kubectl Plugin

If you want to use kubectl remotely, you must first install the kubectl-plugin to get the session ID to access HPE Ezmeral. To install the kubectl-hpecp plugin, you can run the following command. The HPE kubectl plugin is required to establish the tenant’s authenticated kubectl requests. Therefore, if you want to use kubectl remotely as a tenant user, you must first install the HPE kubectl plugin (kubectl-hpecp) to get an HPE ECP authentication token (a session ID), fetch the kubconfig manifest file, and then interact with the managed K8s clusters.

To install the kubectl-hpecp plugin, first fetch the plugin from the WebUI. Log in as a tenant user, and click on Download HPE Kubectl Plugin (as shown in the picture below) and download the plugin and installation instructions according to your target operating system. Note: the following code is all executed in a Linux environment.

Screenshot
Description
You can download the required binary here as well.

Installation of kubectl and kubectl-hpecp

Step 1: Make sure you have kubectl installed.

# Download the latest version of kubectl
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
# And place it anywhere in your PATH:
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl

References:

Step 2: Install hpe kubectl plugin

# This link might subject to be changed, renew this link on HPE Ezmeral
# Download kubectl-hpecp binary and untar the file
wget https://bluedata-releases.s3.amazonaws.com/kubectl-epic/3.4/14/linux/kubectl-hpecp.star
tar xf kubectl-hpecp.star
# And place it anywhere in your PATH:
sudo mv ./kubectl-hpecp /usr/local/bin

Check that kubectl-hpecp is installed correctly.

Command
Screenshot
kubectl plugin list
kubectl hpecp -h

References:

Getting the kubeconfig file

Using kubectl hpecp refresh command

The kubectl hpecp refresh command gets the user a new Kubeconfig. Using the Kubeconfig, you can interact with Kubernetes through the HPE Ezmeral Container Platform.

kubectl hpecp refresh <ip_address, host alias, or hostname> --insecure --hpecp-user=<new_username> --hpecp-pass=<new_password>
# Example
kubectl hpecp refresh 172.16.10.41 --insecure --hpecp-user=your-username --hpecp-pass=your-pass
kubectl hpecp refresh ez53-gateway.hpeilab.com --insecure --hpecp-user=your-username --hpecp-pass=your-pass
kubectl hpecp refresh ez53-gateway.hpeilab.com --insecure

Download your Kubeconfig file, and define the path to the Kubeconfig file as a shell environment variable.

image

# Example
export KUBECONFIG="/home/hpeadmin/.kube/.hpecp/ez53-gateway.hpeilab.com/config"

Download the Kubeconfig file manually

image

Download your kubeconfig file, and define the Kubeconfig file as a shell environment variable:

# Example
export KUBECONFIG="/the/path/of/your/kubeconfig"

Using REST API

HPE Ezmeral Container Platform provides a REST API for you to interact with. Here is the set of REST API calls that allows you to download the Kubeconfig file.

# Authenticate as a tenant user in the specified tenant, getting the session ID:
curl -k -i -s --request POST "http://ez53-gateway.hpeilab.com:8080/api/v2/session" \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "username",
"password": "password",
"tenant_name": "test-tenant"
}'

# output
HTTP/1.1 201 Created
Access-Control-Allow-Origin: *
Content-Length: 13
Content-Type: text/plain
Date: Fri, 30 Apr 2021 13:18:38 GMT
Location: /api/v2/session/__thisisthesessionid__
Server: HPE Ezmeral Container Platform 5.3

201 Created

Get the Kubeconfig file for your tenant working context:

curl -k -s --request GET "http://ez53-gateway.hpeilab.com:8080/api/v2/k8skubeconfig" \
--header "X-BDS-SESSION: /api/v2/session/__thisisthesessionid__" \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' > ./kubeconfig

# Define the Kubeconfig file as a shell environment variable
export KUBECONFIG=kubeconfig

The screenshot below shows you how you can combine two commands into a single command:

curl -k -s --request GET "http://<you-ez-gateway>:8080/api/v2/k8skubeconfig" \
--header "X-BDS-SESSION: $(curl -k -i -s --request POST "http://<you-ez-gateway>:8080/api/v2/session" \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "<change-your-user-name>",
"password": "<change-your-user-password>",
"tenant_name": "<change-the-tenant-you-want>"
}' | grep Location | awk '{print $2}' | tr -d '\r')" \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' > ./kubeconfig

export KUBECONFIG="./kubeconfig"

kubectl get pods

Resources:

hpecp python library (pre-alpha)

If you are looking for a way to interact with HPE Ezmeral programmatically, you can keep an eye on the hpecp python library from HPE Container Platform Community. Note that it is still a prototype, it may be unstable and subject to change until this library reaches beta.

References:

Conclusion

As you can see, HPE Ezmeral Container Platform provides a number of different ways for you to interact with Kubernetes clusters so you can take advantage of the benefits it provides. Just pick your favorite way for your favorite environment. Happy Kubectl!

Related

Ted Dunning & Ellen Friedman

3 ways a data fabric enables a data-first approach

Mar 15, 2022
Nicolas Perez

A Functional Approach to Logging in Apache Spark

Feb 5, 2021
Cenz Wong

Getting Started with DataTaps in Kubernetes Pods

Jul 6, 2021
Kiran Kumar Mavatoor

Accessing HPE Ezmeral Data Fabric Object Storage from Spring Boot S3 Micro Service deployed in K3s cluster

Sep 13, 2021
Carol McDonald

An Inside Look at the Components of a Recommendation Engine

Jan 22, 2021
Carol McDonald

Analyzing Flight Delays with Apache Spark GraphFrames and MapR Database

Dec 16, 2020
Nicolas Perez

Apache Spark as a Distributed SQL Engine

Jan 7, 2021
Carol McDonald

Apache Spark Machine Learning Tutorial

Nov 25, 2020

HPE Developer Newsletter

Stay in the loop.

Sign up for the HPE Developer Newsletter or visit the Newsletter Archive to see past content.

By clicking on “Subscribe Now”, I agree to HPE sending me personalized email communication about HPE and select HPE-Partner products, services, offers and events. I understand that my email address will be used in accordance with HPE Privacy Statement. You may unsubscribe from receiving HPE and HPE-Partner news and offers at any time by clicking on the Unsubscribe button at the bottom of the newsletter.

For more information on how HPE manages, uses, and protects your personal data please refer to HPE Privacy Statement.