mirror of https://github.com/kubernetes/kops.git
Clarify difference between terraform and kOps state stores
This commit is contained in:
parent
9dd9c61514
commit
0de122f751
|
@ -26,7 +26,7 @@ You could keep your Terraform state locally, but we **strongly recommend** savin
|
||||||
```terraform
|
```terraform
|
||||||
terraform {
|
terraform {
|
||||||
backend "s3" {
|
backend "s3" {
|
||||||
bucket = "mybucket"
|
bucket = "terraform_state_bucket"
|
||||||
key = "path/to/my/key"
|
key = "path/to/my/key"
|
||||||
region = "us-east-1"
|
region = "us-east-1"
|
||||||
}
|
}
|
||||||
|
@ -42,14 +42,14 @@ For example, a complete setup might be:
|
||||||
```
|
```
|
||||||
$ kops create cluster \
|
$ kops create cluster \
|
||||||
--name=kubernetes.mydomain.com \
|
--name=kubernetes.mydomain.com \
|
||||||
--state=s3://mycompany.kubernetes \
|
--state=s3://mycompany.kops_state_bucket \
|
||||||
--dns-zone=kubernetes.mydomain.com \
|
--dns-zone=kubernetes.mydomain.com \
|
||||||
[... your other options ...]
|
[... your other options ...]
|
||||||
--out=. \
|
--out=. \
|
||||||
--target=terraform
|
--target=terraform
|
||||||
```
|
```
|
||||||
|
|
||||||
The above command will create kOps state on S3 (defined in `--state`) and output a representation of your configuration into Terraform files. Thereafter you can preview your changes in `kubernetes.tf` and then use Terraform to create all the resources as shown below:
|
The above command will create the [kOps state store](state.md) on S3 (defined in `--state`) and output a representation of your configuration into Terraform files. Thereafter, you can preview your changes in `kubernetes.tf` and then use Terraform to create all the resources as shown below:
|
||||||
|
|
||||||
Additional Terraform `.tf` files could be added at this stage to customize your deployment, but remember the kOps state should continue to remain the ultimate source of truth for the Kubernetes cluster.
|
Additional Terraform `.tf` files could be added at this stage to customize your deployment, but remember the kOps state should continue to remain the ultimate source of truth for the Kubernetes cluster.
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ It's possible to use Terraform to make changes to your infrastructure as defined
|
||||||
```
|
```
|
||||||
$ kops edit cluster \
|
$ kops edit cluster \
|
||||||
--name=kubernetes.mydomain.com \
|
--name=kubernetes.mydomain.com \
|
||||||
--state=s3://mycompany.kubernetes
|
--state=s3://mycompany.kops_state_bucket
|
||||||
|
|
||||||
# editor opens, make your changes ...
|
# editor opens, make your changes ...
|
||||||
```
|
```
|
||||||
|
@ -100,7 +100,7 @@ Then output your changes/edits to kOps cluster state into the Terraform files. R
|
||||||
```
|
```
|
||||||
$ kops update cluster \
|
$ kops update cluster \
|
||||||
--name=kubernetes.mydomain.com \
|
--name=kubernetes.mydomain.com \
|
||||||
--state=s3://mycompany.kubernetes \
|
--state=s3://mycompany.kops_state_bucket \
|
||||||
--out=. \
|
--out=. \
|
||||||
--target=terraform
|
--target=terraform
|
||||||
```
|
```
|
||||||
|
@ -125,7 +125,7 @@ $ terraform plan -destroy
|
||||||
$ terraform destroy
|
$ terraform destroy
|
||||||
$ kops delete cluster --yes \
|
$ kops delete cluster --yes \
|
||||||
--name=kubernetes.mydomain.com \
|
--name=kubernetes.mydomain.com \
|
||||||
--state=s3://mycompany.kubernetes
|
--state=s3://mycompany.kops_state_bucket
|
||||||
```
|
```
|
||||||
|
|
||||||
Ps: You don't have to `kops delete cluster` if you just want to recreate from scratch. Deleting kOps cluster state means that you've have to `kops create` again.
|
Ps: You don't have to `kops delete cluster` if you just want to recreate from scratch. Deleting kOps cluster state means that you've have to `kops create` again.
|
||||||
|
|
Loading…
Reference in New Issue