quiet-wolf-18467
const kubernetesProvider = new k8s.Provider("metrics", {
kubeconfig: config.requireSecret("kubeconfig")
});
gentle-diamond-70147
10/25/2019, 2:59 PMquiet-wolf-18467
error: unable to load Kubernetes client configuration from kubeconfig file: invalid configuration: no configuration has been provide
gentle-diamond-70147
10/25/2019, 3:01 PMfs.readFileSync(...
?quiet-wolf-18467
gentle-diamond-70147
10/25/2019, 3:01 PMquiet-wolf-18467
gentle-diamond-70147
10/25/2019, 3:01 PMkubernetesProvider
object? Are you passing it to each of your kubernetes resources?
e.g.
const ns = new k8s.core.v1.Namespace(name, {}, { provider: kubernetesProvider });
quiet-wolf-18467
import * as fs from "fs";
import * as pulumi from "@pulumi/pulumi";
import * as k8s from "@pulumi/kubernetes";
const config = new pulumi.Config();
const kconfig = fs.readFileSync("../kubeconfig").toString();
const kubernetesProvider = new k8s.Provider("metrics", {
kubeconfig: config.requireSecret("kubeconfig")
});
const appLabels = { app: "nginx" };
const deployment = new k8s.apps.v1.Deployment("nginx", {
spec: {
selector: { matchLabels: appLabels },
replicas: 1,
template: {
metadata: { labels: appLabels },
spec: { containers: [{ name: "nginx", image: "nginx" }] }
}
}
});
export const name = deployment.metadata.name;
gentle-diamond-70147
10/25/2019, 3:39 PMconfig.requireSecret(...)
should definitely work for this so you shouldn't need to do the fs.readFileSync
part.quiet-wolf-18467
export const serviceAccountSecret = new k8s.core.v1.Secret(
"community-token-pulumi",
{
type: "<http://kubernetes.io/service-account-token|kubernetes.io/service-account-token>",
metadata: {
annotations: {
"<http://kubernetes.io/service-account.name|kubernetes.io/service-account.name>": serviceAccount.metadata.name
}
}
}
);