aztack/README.md

116 строки
3.3 KiB
Markdown
Исходник Обычный вид История

2018-03-25 06:05:50 +03:00
# ACStack
Provision a Kubernetes cluster with [Packer](https://packer.io) and [Terraform](https://www.terraform.io) on Azure Resource Manager. Inspired by Kelsey Hightower's [kubestack](https://github.com/kelseyhightower/kubestack) and the [tack](https://github.com/kz8s/tack) project.
2018-03-25 06:05:50 +03:00
## Status
Still WIP
### Packer
Packer step generates an Azure VHD with:
|Software |Version |
|--- |--- |
|Ubuntu |17.10 |
|Docker |1.13.1 |
|etcd |3.1.0-1 |
|kubectl | 1.10.0 |
|kube-apiserver | 1.10.0 |
|kube-controller-manager | 1.10.0 |
|kube-scheduler | 1.10.0 |
2018-03-25 06:05:50 +03:00
### Terraform
- [x] scaffolding of modules implemented:
2018-04-05 21:35:05 +03:00
- [x] controllers/etcd
- [x] PKI
- [x] Azure DNS
- [x] nodes
- [x] bastion
- [x] vnet
- [x] resource group
- [ ] NSGs for controller and nodes
2018-04-04 02:16:26 +03:00
- [ ] separate controllers and nodes into different subnets (with NSGs)
2018-04-05 21:35:05 +03:00
- [ ] Explicit MSI definition
- [ ] token/TLS bootstrap of kubelet https://kubernetes.io/docs/admin/kubelet-tls-bootstrapping/
- [x] separate etcd from controllers
- [ ] certs for etcd, api, and clients
- [ ] kube-proxy on nodes
- [x] example of provisioning in modules/bastion
- [x] example of provisioning in modules/nodes via bastion
2018-03-25 06:05:50 +03:00
* Provisions masters/etcds with etcd and kube components running. However, etcd starts on the first master only. See https://github.com/terraform-providers/terraform-provider-azurerm/issues/1054.
2018-03-25 06:05:50 +03:00
## Prep
- [Install Packer](https://packer.io/docs/installation.html)
- [Install Terraform](https://www.terraform.io/intro/getting-started/install.html)
## Packer Images
Instead of provisioning a VM at boot time, we use Packer to create an immutable image based on a source image. Currently only Ubuntu is supported.
Running the packer commands below will create the following image:
```
acstack-ubuntu-17.10-{{timestamp}}
```
### Create the ACStack Base Image
#### Create resource group
During the build process, Packer creates temporary Azure resources as it builds the source VM. To capture that source VM for use as an image, you must define a resource group. The output from the Packer build process is stored in this resource group.
- `az group create -n myResourceGroup -l westus2`
#### Edit Packer settings
2018-03-28 08:41:59 +03:00
Edit `packer/settings.json` with required settings such as your subscription id.
2018-03-25 06:05:50 +03:00
- To generate credentials: `az ad sp create-for-rbac --query "{ client_id: appId, client_secret: password, tenant_id: tenant }" -o json`
- To get your subscription id: `az account show --query "{ subscription_id: id }" -o json`
```
cd packer
packer build -var-file=settings.json acstack.json
```
## Terraform
Terraform will be used to declare and provision a Kubernetes cluster.
### Prep
TBD
### Provision the Kubernetes Cluster
```
cd terraform
2018-04-06 21:13:01 +03:00
CLUSTER_NAME=mycluster make all # generates Azure credentials and other required configuration and builds infra on Terraform
2018-03-25 06:05:50 +03:00
```
### Resize the number of worker nodes
Edit `terraform/terraform.tfvars`. Set `node_count` to the desired value:
2018-03-25 06:05:50 +03:00
```
node_count = 5
2018-03-25 06:05:50 +03:00
```
Apply the changes:
```
terraform plan
terraform apply
```
```
Apply complete! Resources: 4 added, 0 changed, 0 destroyed.
2018-03-25 06:05:50 +03:00
The state of your infrastructure has been saved to the path
below. This state is required to modify and destroy your
infrastructure, so keep it safe. To inspect the complete state
use the `terraform show` command.
State path: terraform.tfstate
```