limited-dog-7590309/07/2021, 4:10 AM
little-cartoon-1056909/07/2021, 4:43 AM
limited-dog-7590309/07/2021, 8:52 AM
dry-florist-595009/07/2021, 11:55 AM
limited-dog-7590309/07/2021, 1:23 PM
great-queen-3969709/07/2021, 4:09 PM
Then you can export it to your local config so kubectl works:
pulumi stack output kubeconfig --show-secrets > kubeconfig
limited-dog-7590309/07/2021, 5:02 PM
great-queen-3969709/07/2021, 6:07 PM
to start the instance)? If you didn't use Pulumi to configure the instance in the first place, Pulumi doesn't know anything about the instance. In that case, I think you would get better results by getting the kubeconfig directly using the SDK as mentioned earlier in the thread. Otherwise, you would have to import the infrastructure to Pulumi so the Pulumi system knows the current state, then export the kubeconfig from the stack as I noted.
limited-dog-7590309/08/2021, 4:09 AM
great-queen-3969709/08/2021, 4:50 PM
to deploy to EC2, you created a stack. That stack's configuration and state is stored in Pulumi. Any time you create a Kubernetes cluster, there's a kubeconfig. The commands I noted above are terminal commands, not code.
is a command-line interface to manage the stack (see https://www.pulumi.com/docs/reference/cli/pulumi_stack/). If you create a Kubernetes cluster with Pulumi anywhere, not just on a managed service, you can get the kubeconfig from the stack output at the command line.
limited-dog-7590309/09/2021, 5:41 PM
pulumi stack output kubeconfig
great-queen-3969709/16/2021, 12:27 PM
If the kubeconfig file is not in either of these locations, Pulumi will not find it, and it will fail to authenticate against the cluster. (from https://www.pulumi.com/docs/intro/cloud-providers/kubernetes/setup/#steps)If you've successfully run
against the cluster and updated it, then it's already available. If you're saying that you used Ansible to set up EC2 with a Kubernetes cluster and now you want to use Pulumi to manage it from here but have not actually successfully connected, that's a different story, and you do need to use a different tool to get that kubeconfig file before Pulumi can authenticate and access the cluster. If you can run
against the cluster on EC2, you can view the config with
. If you can't run
kubectl config view
against that cluster, you need to connect to the instance and locate the configuration file(s) manually (e.g., if you want to do it through ssh, go through this guide from AWS).
limited-dog-7590309/17/2021, 5:18 AM