Skip to content

Commit

Permalink
Add example of how to retrieve kubeconfig (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
mralexandernickel authored Mar 4, 2022
1 parent 97f685d commit 611274b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
29 changes: 28 additions & 1 deletion managed-k8s/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,38 @@ whereas each worker node has

Provisioning time varies of course but we can expect to take around 10 minutes to spin up the cluster.

## Retrieve kubeconfig

Inside the cluster.tf you can see a defined output. the configured `value` needs
to match the `gridscale_k8s` resource. In the given example, our `gridscale_k8s`
resource is named `mycluster`:

```hcl
resource "gridscale_k8s" "mycluster" {
# ...
}
```

So the configured value of our terraform `output` needs to look like this:

```hcl
output "kubeconfig" {
value = gridscale_k8s.mycluster.kubeconfig
}
```

When you create your cluster terraform will write the kubeconfig now to stdout,
if you need to get the kubeconfig _after_ you've deployed your cluster, you can
do so by calling:

```bash
terraform output kubeconfig
```

## TODO

Missing:

- Show how to retrieve kubeconfig
- Run through a minimum hello world example:
- create a deployment
- create a service
Expand Down
6 changes: 5 additions & 1 deletion managed-k8s/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ resource "gridscale_k8s" "mycluster" {
# Define the desired Kubernetes release. Define which release of GSK will be
# used for the cluster. For convenience, please use gscloud to get the list of
# available Kubernetes releases.
release = "1.17"
release = "1.21"

node_pool {
name = "my_node_pool"
Expand All @@ -24,3 +24,7 @@ resource "gridscale_k8s" "mycluster" {
storage_type = "storage_insane"
}
}

output "kubeconfig" {
value = gridscale_k8s.mycluster.kubeconfig
}

0 comments on commit 611274b

Please sign in to comment.