The Apps CLI plug-in refers to the default kubeconfig file to access a Kubernetes cluster.
When a tanzu apps command is run, the plug-in uses the default context that's defined in that kubeconfig file (located by default at $HOME/.kube/config).
There are two ways to change the target cluster:
- Use
kubectl config use-context <context-name>to change the default context. All subsequenttanzu appscommands will target the cluster defined in the new default kubeconfig context. - Include the
--context <context-name>flag when running anytanzu appscommand. All subsequenttanzu appscommands without the--context <context-name>flag will continue to use the default context set in the kubeconfig.
There are also two ways to override the default kubeconfig:
- Set the env var
KUBECONFIG=<path>to change the kubeconfig the Apps CLI plug-in should reference. All subsequenttanzu appscommands will reference the non-default kubeconfig assigned to the env var. - Include the
--kubeconfig <path>flag when running anytanzu appscommand. All subsequenttanzu appscommands without the--kubeconfig <path>flag will continue to use the default kubeconfig.
For more information about kubeconfig, see Configure Access to Multiple Clusters.
You can use the Apps CLI plug-in to create or update a workload.
After you've successfully submitted your changes to the platform, the CLI command exits.
Depending on the changes you submitted, it might take time for them to be executed on the platform.
Run tanzu apps workload get to check the status of your changes.
For more information on this command, see Tanzu Apps Workload Get.
In many cases, you can manage workload life cycles through CLI commands.
However, you might find cases where you want to manage a workload by using a yaml file.
The Apps CLI plug-in supports using yaml files.
The plug-in is designed to manage one workload at a time.
When you manage a workload using a yaml file, that file must contain a single workload definition.
Plug-in commands support only one file per command.
For example, a valid file looks similar to the following example:
---
apiVersion: carto.run/v1alpha1
kind: Workload
metadata:
name: spring-petclinic
labels:
app.kubernetes.io/part-of: spring-petclinic
apps.tanzu.vmware.com/workload-type: java
spec:
source:
git:
url: https://github.com/sample-accelerators/spring-petclinic
ref:
tag: tap-1.1To enable command autocompletion, the Tanzu CLI offers the tanzu completion command.
Add the following command to the shell config file according to the current setup. Use one of the following options:
tanzu completion bash > $HOME/.tanzu/completion.bash.incecho "autoload -U compinit; compinit" >> ~/.zshrc
tanzu completion zsh > "${fpath[1]}/_tanzu"