Jump to content

Kubernetes Workflow - alfred-kubectl


Recommended Posts

alfred-kubectl

 

This workflow can be used to query a Kubernetes cluster and retrieve resources.

 

Currently the following global resource types are supported:

  • Node
  • Namespace
  • PV

 

And namespaced resource types:

  • Pod
  • Deployment
  • Configmap
  • Secret
  • Statefulset
  • PVC

 

Link to workflow

Link to the Github repo.

 

Usage

The main workflow keyword is kube. The workflow will guide the user through a series of api calls that will end up with a list of resources of the chosen type.

From here the user can use action modifiers to get further info about a resource (describe) using CMD+Enter.

For resource type pod two additional action modifiers are available:

  1. OPTION+Enter: get pod logs
  2. CTL+Enter: open an interactive session in the pod using /bin/sh

 

Another keyword (kube-context) can be used to quickly change context. This can also be set in the workflow configuration.

 

Screenshots

 

Initial prompt - pick a resource type

image.thumb.png.576ef30f8638c26cc7e0fc90ce5d10a6.png

 

Pick a namespace or choose all namespaces

image.thumb.png.3bfd60a38a63ae653d0ccad28d76b581.png

 

Get resources

image.thumb.png.baff467148ac368f1a3afc1caa02f137.png

 

Dependencies

This workflow relies on Python 3 and the following python packages (all shipped with the workflow):

  • os
  • sys
  • json
  • kubernetes

 

The workflow furthermore relies on the Kubectl CLI package for fetching details about the resources, pod logs and for executing code in pods (kubectl exec). Both resource details and pod logs will be moved away from kubectl in a later release, but opening interactive sessions into pods can't be done through the python client.

 

Kubectl can be installed with Homebrew and from binaries.

Edited by ChristianOlsen
Forgot link to workflow on Github
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...