Skip to content

Latest commit

 

History

History
66 lines (38 loc) · 2.51 KB

Kubernetes-CLI.adoc

File metadata and controls

66 lines (38 loc) · 2.51 KB

Kubernetes CLI

The Infinispan CLI currently has two modes: command-line and interactive. To improve the user experience when using the Infinispan Operator we can enhance the CLI to add Kubernetes capabilities.

Native

Using Quarkus we can build the CLI as a native executable for the three most common platforms: Linux x86_64, OS X, Windows.

Kubernetes mode

Installing the executable as kubectl-infinispan allows invocation as a kubectl/oc plugin, e.g.:

kubectl infinispan …​

Using the Fabric8 Kubernetes Client we can automatically detect the existence of a Kubernetes configuration (default to ~/.kube/config) and automatically connect to the Kubernetes cluster.

Kubernetes commands

The Infinispan Kubernetes CLI plugin uses the default namespace for all operations, unless overridden with the --namespace parameter.

Install the operator

kubectl infinispan install [-n namespace]

Install the Infinispan Operator in the specified namespace. This should also install the relevant OLM subscription and operator group so that the operator can be updated.

Create an Infinispan cluster

kubectl infinispan create cluster [-n namespace] [-r replicas] [--expose-type=type] [--expose-port=port] [--expose-host=hostname] [name]

Creates an Infinispan cluster: * -n namespace overrides the namespace. * -r replicas selects the initial number of replicas. Defaults to 1. * --expose-type=LoadBalancer|NodePort|Route selects how the service should be exposed. * --expose-port=port specifies the exposed port for LoadBalancer and NodePort types. * --expose-host=hostname specifies the exposed hostname for the Route type. * --security-secret=secretname specifies the secret to use for endpoint authentication. * --security-cert-secret=secretname the secret that contains a service certificate, tls.crt, and key, tls.key, in PEM format. * --security-cert-service=servicename the Red Hat OpenShift certificate service name.

Scale an Infinispan service

kubectl infinispan scale -r replicas [servicename]

Scale an Infinispan cluster to the specified number of replicas

Interact with a running Infinispan service

kubectl infinispan shell [name]

Connects to one of the active pods of the specified cluster and launches the CLI in interactive mode.

Remove an Infinispan service

kubectl infinispan delete cluster [-n namespace] [servicename]

Stops and removes an Infinispan service.

Uninstalling the operator

kubectl infinispan uninstall [-n namespace]

Removes the Infinispan operator