kubectl-1.4.0

KOSI Plugin Kubectl

Release-Notes

Version 1.4.0

New

  • nothing

Updates

  • update toolchain dependencies 1.0.15

Summary

This plugin can be used to execute kubectl commands.

Keys

Key Description
operation mandatory set it to the required subcommand of kubectl.
resource mandatory for most operations set it to the type of resource on which the operation should be executed. Every official kubernetes resource is supported.
resourceName optional This key specifies the name of the resource. Names are case-sensitive. If this key is set the operation to the resources with the given names.
flags optional set it to the flag supported by the given kubectl operation. When using the flag “-f” you need to include the absolute path to the file which you want to pass. You can append multiple flag separated by space Example: “-f PathToYAML -A -o wide”'
verb optional set this to a verb supported by Kubernetes. Use this key in combination with operations like “config” or “can-i”.
outputVar optional set it to a new variable name in which you want to save the output of the kubectl command
outputFile optional Use this key if you want to save the output of the executed command to a file. The value has to be an absolute path.
sudo optional Set to true to execute the Plugin with sudo privileges.
sudoPassword mandatory If you use sudo, sudoPassword will be mandatory

Example

Example 1

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/sina/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

install
{
    kubectl(
        operation='"get"'; 
        resource='"pods"'; 
        resourceName='"testDeployment"'; 
        flags='"-n kube-system -o wide"'; 
        outputVar='"outputGet"'; 
        outputFile='"/root/outputKubectlGet.txt"'; 
        sudo='"true"';
        sudoPassword='"Drowssap"'
    );
}

Example 2

When performing an operation on multiple resources with the same type, you can specify each resource by type and name:

languageversion = "0.1.0";
apiversion = "kubernative/kubeops/sina/user/v3";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

install
{
    kubectl(
        operation='"get"'; 
        resource='"pod"'; 
        resourceName='"example-pod1 example-pod2"'; 
        sudo='"true"';
        sudoPassword='"Drowssap"'
    );
}