Skip to main content
Loading
Version: Operator 3.1.0

Aerospike Kubernetes Operator Command Line Tool

akoctl is a Krew plugin for the Kubernetes Operator. It provides multiple sub-commands to perform different functions related to Aerospike Kubernetes Operator and Aerospike Kubernetes Cluster.

Install with Krew plugin managerโ€‹

  1. Install Krew.

    Follow the Krew setup instructions here.

  2. Install akoctl:

kubectl krew index add akoctl https://github.com/aerospike/aerospike-kubernetes-operator-ctl.git
kubectl krew index list
INDEX    URL
akoctl https://github.com/aerospike/aerospike-kubernetes-operator-ctl.git
default https://github.com/kubernetes-sigs/krew-index.git
kubectl krew install akoctl/akoctl
Updated the local copy of plugin index "akoctl".
Updated the local copy of plugin index.
Installing plugin: akoctl
Installed plugin: akoctl
\
| Use this plugin:
| kubectl akoctl
| Documentation:
| https://github.com/aerospike/aerospike-kubernetes-operator-ctl
/

Upgrade to latest version if already installedโ€‹

kubectl krew upgrade akoctl

Available sub-commandsโ€‹

Global Flags:โ€‹

There are certain global flags associated with akoctl

FlagShorthandTypeDescription
all-namespaces-AboolSpecify all namespaces present in cluster.
namespaces-nstringComma-separated list of namespaces to operate in.
kubeconfigstringAbsolute path to the kubeconfig file.
cluster-scopeboolPermission to work in cluster scoped mode (operate on cluster scoped resources like ClusterRoleBinding). Default true.

collectinfo sub-commandโ€‹

akoctl uses the collectinfo command to collect logs and objects from a given namespace and cluster-scoped resources. collectinfo collects the following data:

  • All container logs
  • All event logs
  • Inventory of the following objects:
    Namespace ScopedCluster Scoped
    PodsNodes
    StatefulSetsPersistentVolumes
    DeploymentsStorageClasses
    PersistentVolumeClaimsMutatingWebhookConfigurations
    ServicesValidatingWebhookConfigurations
    AerospikeClusters

Requirementsโ€‹

akoctl inherits the user's kubectl permissions. If a user cannot access a particular resource, its logs do not appear in the akoctl results.

  • Current user should have the list and get permission for all the objects collected by the command.
  • If cluster-scope flag is set, along with the previously mentioned permissions, user should have list and get permission for cluster-scoped resources like Nodes and StorageClasses.
  • kubectl binary should be available in the system PATH environment variable.

Associated Flagsโ€‹

FlagShorthandTypeDescription
pathstringAbsolute path to save output tar file.

Example:

kubectl akoctl collectinfo -n aerospike,olm --path ~/sample-directory/

This creates a timestamped tar file called scraperlogs-<timestamp> and saves it in the ~/sample-directory/ directory. The directory structure appears as follows:

akoctl_collectinfo
โ”œโ”€โ”€ akoctl.log
โ”œโ”€โ”€ k8s_cluster
โ”‚ย ย  โ”œโ”€โ”€ nodes
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ <node1 name>.yaml
โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ <node2 name>.yaml
โ”‚ย ย  โ””โ”€โ”€ storageclasses
โ”‚ย ย  โ”œโ”€โ”€ <storageclass name>.yaml
โ”‚ย ย  โ””โ”€โ”€ mutatingwebhookconfigurations
โ”‚ย ย  โ”œโ”€โ”€ <mutatingwebhook name>.yaml
โ”‚ย ย  โ””โ”€โ”€ validatingwebhookconfigurations
โ”‚ย ย  โ”œโ”€โ”€ <validatingwebhook name>.yaml
โ”‚ย ย  โ””โ”€โ”€ persistentvolumes
โ”‚ย ย  โ”œโ”€โ”€ <persistentvolume name>.yaml
โ”‚ย ย  โ””โ”€โ”€ summary
โ”‚ย ย  โ”œโ”€โ”€ summary.txt
โ””โ”€โ”€ k8s_namespaces
โ””โ”€โ”€ aerospike
โ”œโ”€โ”€ aerospikeclusters
โ”‚ย ย  โ”œโ”€โ”€ <aerospikecluster name>.yaml
โ”œโ”€โ”€ persistentvolumeclaims
โ”‚ย ย  โ”œโ”€โ”€ <pvc name>.yaml
โ”œโ”€โ”€ pods
โ”‚ย ย  โ”œโ”€โ”€ <pod name>
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ <pod name>.yaml
โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ logs
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ previous
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ <container name>.log
โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ <container name>.log
โ””โ”€โ”€ statefulsets
โ”‚ย ย  โ”œโ”€โ”€ <sts name>.yaml
โ””โ”€โ”€ deployments
โ”‚ย ย  โ”œโ”€โ”€ <deployment name>.yaml
โ””โ”€โ”€ services
โ”‚ย ย  โ”œโ”€โ”€ <service name>.yaml
โ””โ”€โ”€ summary
โ”‚ย ย  โ”œโ”€โ”€ summary.txt
โ”‚ย ย  โ”œโ”€โ”€ events.txt
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

auth sub-commandโ€‹

akoctl uses the auth command to create and delete RBAC resources for the Aerospike cluster for the given namespaces. It creates/deletes ServiceAccount, RoleBinding or ClusterRoleBinding as per given scope of operation.

There are 2 sub-commands associated with auth command:

  • create - Creates and updates RBAC resources for the given namespaces.
  • delete - Deletes RBAC resources for the given namespaces.

If cluster-scope is set (default true), the auth command grants cluster level RBAC. In case of cluster-scope false, it grants namespace level RBAC.

Requirements:โ€‹

akoctl inherits the user's kubectl permissions. If a user doesn't have RBAC access, it cannot grant RBAC for that resource.

  • Current user should have the CREATE, GET, UPDATE and DELETE permissions for ServiceAccount and RoleBinding.
  • If the cluster-scope flag is set, user should have the CREATE, GET, UPDATE and DELETE permissions for ServiceAccount and ClusterRoleBinding.

The following example creates namespace-scope RBAC resources for the aerospike namespace:

kubectl akoctl auth create -n aerospike --cluster-scope=false

The following example creates cluster-scope RBAC resources for the aerospike namespace:

kubectl akoctl auth create -n aerospike 

The following example deletes namespace-scope RBAC resources for the aerospike namespace:

kubectl akoctl auth delete -n aerospike --cluster-scope=false

The following example deletes cluster-scope RBAC resources for the aerospike namespace:

kubectl akoctl auth delete -n aerospike