@@ -44,8 +44,8 @@ respective repositories for how to deploy Tiller on those platforms. <!-- TODO:
44
44
45
45
## Installing necessary tools
46
46
47
- In addition to ` terraform ` , this guide uses ` kubergrunt ` to manage the deployment of Tiller. You can read more about the
48
- decision behind this approach in [ the Appendix] ( #appendix-a-why-kubergrunt ) of this guide.
47
+ In addition to ` terraform ` , this guide uses ` kubergrunt ` to manage TLS certificates for the deployment of Tiller. You
48
+ can read more about the decision behind this approach in [ the Appendix] ( #appendix-a-why-kubergrunt ) of this guide.
49
49
50
50
This means that your system needs to be configured to be able to find ` terraform ` , ` kubergrunt ` , and ` helm ` client
51
51
utilities on the system ` PATH ` . Here are the installation guide for each:
@@ -76,7 +76,7 @@ Tiller! To deploy Tiller, we will use the example Terraform code at the root of
76
76
- ` terraform apply `
77
77
- Fill in the required variables based on your needs. <!-- TODO: show example inputs here -->
78
78
79
- The Terraform code creates a few resources before deploying Tiller using ` kubergrunt ` :
79
+ The Terraform code creates a few resources before deploying Tiller:
80
80
81
81
- A Kubernetes ` Namespace ` (the ` tiller-namespace ` ) to house the Tiller instance. This namespace is where all the
82
82
Kubernetes resources that Tiller needs to function will live. In production, you will want to lock down access to this
@@ -89,32 +89,27 @@ The Terraform code creates a few resources before deploying Tiller using `kuberg
89
89
` tiller-namespace ` and the ` resource-namespace ` , so that it can:
90
90
- Manage its own resources in the ` tiller-namespace ` , where the Tiller metadata (e.g release tracking information) will live.
91
91
- Manage the resources deployed by helm charts in the ` resource-namespace ` .
92
+ - Using ` kubergrunt ` , generate a TLS CA certificate key pair and a set of signed certificate key pairs for the server
93
+ and the client. These will then be uploaded as ` Secrets ` on the Kubernetes cluster.
92
94
93
- Then it will feed the names of the created resources into the ` kubergrunt helm deploy ` command. As part of the
94
- deployment, ` kubergrunt ` will:
95
+ These resources are then passed into the ` k8s-tiller ` module where the Tiller ` Deployment ` resources will be created.
96
+ Once the resources are applied to the cluster, this will wait for the Tiller ` Deployment ` to roll out the ` Pods ` using
97
+ ` kubergrunt helm wait-for-tiller ` .
95
98
96
- - Create a new TLS certificate key pair to use as the CA and upload it to Kubernetes as a ` Secret ` in the ` kube-system `
97
- namespace.
98
- - Using the generated CA TLS certificate key pair, create a signed TLS certificate key pair to use to identify the
99
- Tiller server and upload it to Kubernetes as a ` Secret ` in the ` tiller-namespace ` .
100
- - Deploy Tiller with the following configurations turned on:
101
- - TLS verification
102
- - ` Secrets ` as the storage engine
103
- - Provisioned in the ` tiller-namespace ` with the service account as the ` tiller-service-account `
99
+ Finally, to allow you to use ` helm ` right away, this code also sets up the local ` helm ` client. This involves:
104
100
105
- - Grant access to the provided RBAC entity and configure the local helm client to use those credentials:
106
- - Using the CA TLS certificate key pair, create a signed TLS certificate key pair to use to identify the client.
107
- - Upload the certificate key pair to the ` tiller-namespace ` .
108
- - Grant the RBAC entity access to:
109
- - Get the client certificate ` Secret ` (` kubergrunt helm configure ` uses this to install the client certificate
110
- key pair locally)
111
- - Get and List pods in ` tiller-namespace ` (the ` helm ` client uses this to find the Tiller pod)
112
- - Create a port forward to the Tiller pod (the ` helm ` client uses this to make requests to the Tiller pod)
101
+ - Using the CA TLS certificate key pair, create a signed TLS certificate key pair to use to identify the client.
102
+ - Upload the certificate key pair to the ` tiller-namespace ` .
103
+ - Grant the RBAC entity access to:
104
+ - Get the client certificate ` Secret ` (` kubergrunt helm configure ` uses this to install the client certificate
105
+ key pair locally)
106
+ - Get and List pods in ` tiller-namespace ` (the ` helm ` client uses this to find the Tiller pod)
107
+ - Create a port forward to the Tiller pod (the ` helm ` client uses this to make requests to the Tiller pod)
113
108
114
- - Install the client certificate key pair to the helm home directory so the client can use it.
109
+ - Install the client certificate key pair to the helm home directory so the client can use it.
115
110
116
- You should now have a working Tiller deployment with your helm client configured to access it.
117
- So let's verify that in the next step!
111
+ At the end of the ` apply ` , you should now have a working Tiller deployment with your ` helm ` client configured to access
112
+ it. So let's verify that in the next step!
118
113
119
114
120
115
## Verify Tiller Deployment
@@ -177,20 +172,6 @@ kubergrunt helm configure --tiller-namespace NAMESPACE_OF_TILLER --rbac-group de
177
172
At the end of this, your users should have the same helm client setup as above.
178
173
179
174
180
- ## Upgrading Deployed Tiller
181
-
182
- At some point in the lifetime of the Tiller deployment, you will want to upgrade it. You can upgrade the deployed Tiller
183
- instance using the helm client with the following command:
184
-
185
- ```
186
- helm init --upgrade --tiller-namespace TILLER_NAMESPACE
187
- ```
188
-
189
- ** Note** : You need to be an administrator to run this command. Specifically, this should be done with the same ` kubectl `
190
- context as the one used to deploy Tiller. You can use the ` --kube-context ` option to use a different context from the
191
- default.
192
-
193
-
194
175
## Appendix A: Why kubergrunt?
195
176
196
177
This Terraform example is not idiomatic Terraform code in that it relies on an external binary, ` kubergrunt ` as opposed
@@ -204,16 +185,21 @@ to implementing the functionalities using pure Terraform providers. This approac
204
185
` destroy ` .
205
186
206
187
That said, we decided to use this approach because of limitations in the existing providers to implement the
207
- functionalities here in pure Terraform code:
188
+ functionalities here in pure Terraform code.
189
+
190
+ ` kubergrunt ` fulfills the role of generating and managing TLS certificate key pairs using Kubernetes ` Secrets ` as a
191
+ database. This allows us to deploy Tiller with TLS verification enabled. We could instead use the ` tls ` and ` kubernetes `
192
+ providers in Terraform, but this has a few drawbacks:
208
193
209
- - The Helm provider does not have [ a resource that manages
210
- Tiller] ( https://github.com/terraform-providers/terraform-provider-helm/issues/134 ) .
211
194
- The [ TLS provider] ( https://www.terraform.io/docs/providers/tls/index.html ) stores the certificate key pairs in plain
212
195
text into the Terraform state.
213
196
- The Kubernetes Secret resource in the provider [ also stores the value in plain text in the Terraform
214
197
state] ( https://www.terraform.io/docs/providers/kubernetes/r/secret.html ) .
215
198
- The grant and configure workflows are better suited as CLI tools than in Terraform.
216
199
217
- Note that [ we intend to implement a pure Terraform version of this when the Helm provider is
218
- updated] ( https://github.com/gruntwork-io/terraform-kubernetes-helm/issues/13 ) , but we plan to continue to maintain the
200
+ ` kubergrunt ` works around this by generating the TLS certs and storing them in Kubernetes ` Secrets ` directly. In this
201
+ way, the generated TLS certs never leak into the Terraform state as they are referenced by name when deploying Tiller as
202
+ opposed to by value.
203
+
204
+ Note that we intend to implement a pure Terraform version of this functionality, but we plan to continue to maintain the
219
205
` kubergrunt ` approach for folks who are wary of leaking secrets into Terraform state.
0 commit comments