Comments (4)
Definitely would make sense to expose it as a public API here - but note that you can construct it from aws.eks.Cluster.get()
using this code from the implementation of the library:
pulumi-eks/nodejs/eks/cluster.ts
Lines 182 to 233 in 4f4a75b
from pulumi-eks.
I was very disappointed to find that the object returned by getCluster does not have a kubeconfig or Kubernetes provider.
I wanted to move the code that installs stuff into the cluster into a different project from the project that creates the cluster. The project was getting way too big and the dependency handling was a problem, especially when trying to destroy and rebuild a cluster.
I tried using the source code for generateKubeConfig, copied into my pulumi project with this source code, but it still does not work:
const cluster = aws.eks.getClusterOutput({ name: config.accountName });
const kubeconfig = generateKubeconfig(cluster.name, cluster.endpoint, cluster.certificateAuthorities[0].data);
const kubernetesProvider = new kubernetes.Provider('kubernetes-provider', {
kubeconfig: kubeconfig.apply(JSON.stringify),
});
const argoCdCrds = new kubernetes.kustomize.Directory(
'argo-cd-crds',
{
directory: `https://github.com/argoproj/argo-cd/tree/${argoCdApplicationVersion}/manifests/crds`,
resourcePrefix: 'argo-cd-crds',
},
{
provider: kubernetesProvider,
}
);
I know the connection to AWS is good, because getClusterOutput returns valid endpoints and certs. I can look at the value for kubconfig in an exported state.json file, and they are IDENTICAL to the values in my pulumi project that creates the cluster, where this code ran before.
But, I get this error:
kubernetes:apiextensions.k8s.io/v1:CustomResourceDefinition (argo-cd-crds-appprojects.argoproj.io):
warning: configured Kubernetes cluster is unreachable: unable to load schema information from the API server: the server has asked for the client to provide credentials
error: failed to read resource state due to unreachable cluster. If the cluster was deleted, you can remove this resource from Pulumi state by rerunning the operation with the PULUMI_K8S_DELETE_UNREACHABLE environment variable set to "true"
Does anyone know what I might be missing?
from pulumi-eks.
@RobCannon did you find a solution? they recommend importing the cluster, but that fails too:
const currentProvider = new aws.Provider("current", {
region: awsConfig.require('region') as aws.Region,
accessKey: awsConfig.require('accessKey'),
secretKey: awsConfig.requireSecret('secretKey'),
});
const cluster = new eks.Cluster("cluster", {
}, {
id: "eu-west-3",
provider: currentProvider,
});
error: ResourceError: Cannot read an existing resource unless it has a custom provider
from pulumi-eks.
My current workaround looks like this:
const cluster = aws.eks.getCluster({
name: "hpi-eks-prod",
});
const kubeconfig = pulumi.output(cluster).apply(cluster => ({
apiVersion: "v1",
kind: "Config",
"current-context": "aws",
clusters: [{
name: "kubernetes",
cluster: {
server: cluster.endpoint,
"certificate-authority-data": cluster.certificateAuthorities[0].data,
},
}],
users: [{
name: "aws",
user: {
exec: {
apiVersion: "client.authentication.k8s.io/v1beta1",
command: "aws",
args: ["eks", "get-token", "--cluster-name", cluster.name],
},
},
}],
contexts: [{
name: "aws",
context: {
cluster: "kubernetes",
user: "aws",
},
}],
}));
const provider = new k8s.Provider("default", {
kubeconfig: kubeconfig.apply(JSON.stringify),
});
from pulumi-eks.
Related Issues (20)
- ManagedNodeGroup should be able to specify an AMI ID override
- Workflow failure: cron HOT 1
- Workflow failure: master HOT 1
- Unable to specify `nodeRootVolumeIops` and `nodeRootVolumeThroughput` in node group resources
- Upgrade tests are broken after release v2.5.0
- Keep pulumi-aws reference up-to-date with automation
- `instanceRole` still created when `skipDefaultNodeGroup` is enabled. HOT 1
- eks.ManagedNodeGroup with amiType: 'AL2023_ARM_64_STANDARD' breaks when kubeletExtraArgs specified HOT 5
- Upgrade tests fails whenever there is a new recommended AMI ID
- Generate Node SDK using the standard codegen tooling HOT 3
- Enforce linting rules in CI
- Workflow failure: master
- Workflow failure: master
- VPC CNI creation does not respect the `proxy` config or `HTTP_PROXY` environment variable HOT 1
- eks.ManagedNodeGroup: launchTemplate is ignored HOT 2
- clusterSecurityGroupTags applied to Additional security group. Must assign to Acutal cluster security group. HOT 3
- Support AL2023 & Bottlerocket for managed node groups
- Cannot create `ManagedNodeGroup` for cluster with `API` authentication mode
- Allow users to set KMS key when encrypting node block devices HOT 2
- Workflow failure: cron HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pulumi-eks.