Learn R Programming

AzureContainers (version 1.0.2)

call_kubectl: Call the Kubernetes commandline tool, kubectl

Description

Call the Kubernetes commandline tool, kubectl

Usage

call_kubectl(cmd = "", ...)

Arguments

cmd

The kubectl command line to execute.

...

Other arguments to pass to system2.

Value

By default, the return code from the kubectl binary. The return value will have an added attribute cmdline that contains the command line. This makes it easier to construct scripts that can be run outside R.

Details

This function calls the kubectl binary, which must be located in your search path. AzureContainers will search for the binary at package startup, and print a warning if it is not found.

See Also

system2, call_docker, call_helm

kubernetes_cluster

Kubectl command line reference

Examples

Run this code
# NOT RUN {
# without any args, prints the kubectl help screen
call_kubectl()

# append "--help" to get help for a command
call_kubectl("create --help")

# deploy a service from a yaml file
call_kubectl("create -f deployment.yaml")

# get deployment and service status
call_kubectl("get deployment")
call_kubectl("get service")

# }

Run the code above in your browser using DataLab