06/27/2019, 9:59 PM
Hi folks- I’m trying to instantiate & use a kubernetes config from another stack and having trouble getting the argument types right. Can anyone point me in the right direction? code and error message follows in thread.
Copy code
let kubeConfig = new pulumi.StackReference("mikedougherty/megadoomer-core/main").getOutput("kubeconfig");
let kubernetes = new k8s.Provider("k8s", { kubeconfig: kubeConfig} );

const vpn = new k8s.helm.v2.Chart("openvpn", {
    repo: "stable",
    chart: "openvpn",
    values: {
        "openvpn.OVPN_K8S_POD_NETWORK": "",
        "openvpn.OVPN_K8S_POD_SUBNET": "",
        "openvpn.OVPN_NETWORK": "",
        "openvpn.OVPN_SUBNET": "",
        "openvpn.redirectGateway": false,
}, { providers: [kubernetes] });
and i’ve tried a few other variations for the
{providers: ...}
map in the final argument as well.
Error message from preview portion of `pulumi up`:
Copy code
error: pulumi:providers:kubernetes resource 'k8s's property 'kubeconfig' value {map[...]} has a problem: provider property values must be strings
(map contents redacted / removed for brevity)


06/28/2019, 1:13 AM
you try making it a string?
Copy code
let kubernetes = new k8s.Provider("k8s", { kubeconfig: JSON.stringify(kubeConfig)} );


06/28/2019, 7:29 AM
The kubeconfig property wants the YAML version of the config - in AKS (for example) that is exposed via `kubeConfigRaw`(in typescript). I’m not 100% certain about how it’s exposed by others - but that’s the issue here.


06/28/2019, 4:59 PM
@busy-umbrella-36067 your solution worked with a slight tweak:
Copy code
let kubernetes = new k8s.Provider("k8s", { kubeconfig: kubeConfig.apply(JSON.stringify) } );
. thanks! i thought that the problem was in the
new Chart
but I guess was looking in the wrong place. thanks very much!
🎉 1
@stocky-spoon-28903 thanks, i might check in on switching to AKS at some point and will keep that in mind