11/30/2022, 11:53 PM
Hi, I am trying to test the local.command on the Kubernetes environment - Following this doc - However, getting an error. Am I doing something wrong? posting the exception here, thanks
import { local } from "@pulumi/command";
import * as eks from "@Pulumi/eks";
const cluster = new eks.Cluster("cluster", {});
const createKubernetesNamespace = new local.Command("createKubernetesNamespace", {
create: "kubectl create namespace test-namespace",
environment: {
KUBECONFIG: cluster.kubeconfig,
Diagnostics: command:local:Command (createKubernetesNamespace): error: 1 failures decoding: environment[KUBECONFIG] value: An error occurred decoding 'command.environment[KUBECONFIG] value': Cannot decode Object{} to type string; it isn't a struct, and no custom decoder exists


12/01/2022, 12:25 AM
env var is expecting a path, but the
property is returning the kubeconfig as an object. This worked for me locally:
import { local } from "@pulumi/command";

new local.Command("createNamespace", {
    create: "kubectl create namespace test-namespace",
    delete: "kubectl delete namespace test-namespace",
    environment: {
        KUBECONFIG: `/Users/levi/.kube/config`,


12/07/2022, 11:19 PM
hi @gorgeous-egg-16927, Thank you again for earlier response! Looking to use the kubeconfig through the program and not have to refer it locally. The use case is to delete few Kubernetes resources which get created by default and hence try to use the Pulumi command to achieve that
Was trying this approach using the pulumi command however experiencing an error
const my_kubeconfig = '{"apiVersion":"v1","clusters":{"certificate-authority-data":****},{"name":"AWS_PROFILE","value":"default"}]}}}]}' const deleteTestNamespace = new local._Command_("deleteTestNamespace", { create:
kubectl --config <(echo ${my_kubeconfig}) delete namespace test-namespace
, });
Got the following error - error: /bin/sh: -c: line 0: syntax error near unexpected token `(' - error: exit status 2. Could you please let me know if this achievable ?