Skip to content

Commit

Permalink
feat: default to bootstrap workflow
Browse files Browse the repository at this point in the history
Changes `gen config` to output `controlplane` and `join` machine config
types only. Users can manually set the `type` to `init` if they need to.

Signed-off-by: Andrew Rynhard <andrew@rynhard.io>
  • Loading branch information
andrewrynhard authored and talos-bot committed Jun 3, 2021
1 parent 76aac4b commit a71053f
Show file tree
Hide file tree
Showing 17 changed files with 219 additions and 176 deletions.
2 changes: 1 addition & 1 deletion cmd/talosctl/cmd/mgmt/config.go
Expand Up @@ -237,7 +237,7 @@ func writeV1Alpha1Config(args []string) error {
return err
}

if err = configBundle.Write(genConfigCmdFlags.outputDir, commentsFlags, machine.TypeInit, machine.TypeControlPlane, machine.TypeJoin); err != nil {
if err = configBundle.Write(genConfigCmdFlags.outputDir, commentsFlags, machine.TypeControlPlane, machine.TypeJoin); err != nil {
return err
}

Expand Down
12 changes: 12 additions & 0 deletions hack/release.toml
Expand Up @@ -40,6 +40,18 @@ Added the flag `cluster.coreDNS.disabled` to coreDNS deployment during the clust
description = """\
* containerd was updated to 1.5.2
* Linux kernel was updated to 5.10.29
"""

[notes.bootstrap]
title = "Default to Bootstrap workflow"
description = """\
The `init.yaml` is no longer an output of `talosctl gen config`.
We now encourage using the bootstrap API, instead it `init` node types, as we
intend on deprecating this machine type in the future.
The `init.yaml` and `controlplane.yaml` machine configs are identical with the
exception of the machine type.
Users can use a modified `controlplane.yaml` with the machine type set to
`init` if they would like to avoid using the bootstrap API.
"""

[make_deps]
Expand Down
4 changes: 1 addition & 3 deletions internal/integration/cli/gen.go
Expand Up @@ -153,15 +153,13 @@ func (suite *GenSuite) TestGenConfigPatch() {
{
flag: "config-patch",
shouldAffect: map[string]bool{
"init.yaml": true,
"controlplane.yaml": true,
"join.yaml": true,
},
},
{
flag: "config-patch-control-plane",
shouldAffect: map[string]bool{
"init.yaml": true,
"controlplane.yaml": true,
},
},
Expand All @@ -177,7 +175,7 @@ func (suite *GenSuite) TestGenConfigPatch() {
suite.Run(tt.flag, func() {
suite.RunCLI([]string{"gen", "config", "foo", "https://192.168.0.1:6443", "--" + tt.flag, string(patch)})

for _, configName := range []string{"init.yaml", "controlplane.yaml", "join.yaml"} {
for _, configName := range []string{"controlplane.yaml", "join.yaml"} {
cfg, err := configloader.NewFromFile(configName)

suite.Assert().NoError(err)
Expand Down
2 changes: 1 addition & 1 deletion internal/integration/cli/validate.go
Expand Up @@ -54,7 +54,7 @@ func (suite *ValidateSuite) TearDownTest() {
func (suite *ValidateSuite) TestValidate() {
suite.RunCLI([]string{"gen", "config", "foobar", "https://10.0.0.1"})

for _, configFile := range []string{"init.yaml", "controlplane.yaml", "join.yaml"} {
for _, configFile := range []string{"controlplane.yaml", "join.yaml"} {
configFile := configFile

for _, mode := range []string{"cloud", "container"} {
Expand Down
27 changes: 19 additions & 8 deletions website/content/docs/v0.11/Bare Metal Platforms/digital-rebar.md
Expand Up @@ -26,7 +26,6 @@ Using the DNS name of the load balancer, generate the base configuration files f

```bash
$ talosctl gen config talos-k8s-metal-tutorial https://<load balancer IP or DNS>:<port>
created init.yaml
created controlplane.yaml
created join.yaml
created talosconfig
Expand All @@ -42,8 +41,6 @@ Optionally, you can specify `--config-patch` with RFC6902 jsonpatch which will b
#### Validate the Configuration Files

```bash
$ talosctl validate --config init.yaml --mode metal
init.yaml is valid for metal mode
$ talosctl validate --config controlplane.yaml --mode metal
controlplane.yaml is valid for metal mode
$ talosctl validate --config join.yaml --mode metal
Expand All @@ -53,15 +50,15 @@ join.yaml is valid for metal mode
#### Publishing the Machine Configuration Files

Digital Rebar has a build-in fileserver, which means we can use this feature to expose the talos configuration files.
We will place `init.yaml`, `controlplane.yaml`, and `worker.yaml` into Digital Rebar file server by using the `drpcli` tools.
We will place `controlplane.yaml`, and `worker.yaml` into Digital Rebar file server by using the `drpcli` tools.

Copy the generated files from the step above into your Digital Rebar installation.

```bash
drpcli file upload <file>.yaml as <file>.yaml
```

Replacing `<file>` with init, controlplane or worker.
Replacing `<file>` with controlplane or worker.

### Download the boot files

Expand Down Expand Up @@ -132,7 +129,6 @@ We're using some of Digital Rebar build in templating to make sure the machine g
This is why we also include a `params.yaml` in the example directory to make sure the role is set to one of the following:

- controlplane
- init
- worker

The `{{.Param \"talos/role\"}}` then gets populated with one of the above roles.
Expand All @@ -150,12 +146,27 @@ Once this is done, you can boot the machine.

To understand the boot process, we have a higher level overview located at [metal overview.](/v0.11/en/guides/metal/overview)

### Retrieve the `kubeconfig`
### Bootstrap Etcd

To configure `talosctl` we will need the first control plane node's IP:

Once everything is running we can retrieve the admin `kubeconfig` by running:
Set the `endpoints` and `nodes`:

```bash
talosctl --talosconfig talosconfig config endpoint <control plane 1 IP>
talosctl --talosconfig talosconfig config node <control plane 1 IP>
```

Bootstrap `etcd`:

```bash
talosctl --talosconfig talosconfig bootstrap
```

### Retrieve the `kubeconfig`

At this point we can retrieve the admin `kubeconfig` by running:

```bash
talosctl --talosconfig talosconfig kubeconfig .
```
36 changes: 17 additions & 19 deletions website/content/docs/v0.11/Bare Metal Platforms/equinix-metal.md
Expand Up @@ -54,41 +54,26 @@ Using the DNS name of the loadbalancer created earlier, generate the base config

```bash
$ talosctl gen config talos-k8s-aws-tutorial https://<load balancer IP or DNS>:<port>
created init.yaml
created controlplane.yaml
created join.yaml
created talosconfig
```

Now add the required shebang (e.g. `#!talos`) at the top of `init.yaml`, `controlplane.yaml`, and `join.yaml`
Now add the required shebang (e.g. `#!talos`) at the top of `controlplane.yaml`, and `join.yaml`
At this point, you can modify the generated configs to your liking.
Optionally, you can specify `--config-patch` with RFC6902 jsonpatch which will be applied during the config generation.

#### Validate the Configuration Files

```bash
talosctl validate --config init.yaml --mode metal
talosctl validate --config controlplane.yaml --mode metal
talosctl validate --config join.yaml --mode metal
```

> Note: Validation of the install disk could potentially fail as the validation
> is performed on you local machine and the specified disk may not exist.
#### Create the Bootstrap Node

```bash
packet device create \
--project-id $PROJECT_ID \
--facility $FACILITY \
--ipxe-script-url $PXE_SERVER \
--operating-system "custom_ipxe" \
--plan $PLAN\
--hostname $HOSTNAME\
--userdata-file init.yaml
```

#### Create the Remaining Control Plane Nodes
#### Create the Control Plane Nodes

```bash
packet device create \
Expand Down Expand Up @@ -116,12 +101,25 @@ packet device create \
--userdata-file join.yaml
```

### Retrieve the `kubeconfig`
### Bootstrap Etcd

At this point we can retrieve the admin `kubeconfig` by running:
Set the `endpoints` and `nodes`:

```bash
talosctl --talosconfig talosconfig config endpoint <control plane 1 IP>
talosctl --talosconfig talosconfig config node <control plane 1 IP>
```

Bootstrap `etcd`:

```bash
talosctl --talosconfig talosconfig bootstrap
```

### Retrieve the `kubeconfig`

At this point we can retrieve the admin `kubeconfig` by running:

```bash
talosctl --talosconfig talosconfig kubeconfig .
```
54 changes: 20 additions & 34 deletions website/content/docs/v0.11/Bare Metal Platforms/matchbox.md
Expand Up @@ -19,7 +19,6 @@ Using the DNS name of the load balancer, generate the base configuration files f

```bash
$ talosctl gen config talos-k8s-metal-tutorial https://<load balancer IP or DNS>:<port>
created init.yaml
created controlplane.yaml
created join.yaml
created talosconfig
Expand All @@ -31,8 +30,6 @@ Optionally, you can specify `--config-patch` with RFC6902 jsonpatch which will b
#### Validate the Configuration Files

```bash
$ talosctl validate --config init.yaml --mode metal
init.yaml is valid for metal mode
$ talosctl validate --config controlplane.yaml --mode metal
controlplane.yaml is valid for metal mode
$ talosctl validate --config join.yaml --mode metal
Expand All @@ -43,7 +40,7 @@ join.yaml is valid for metal mode

In bare-metal setups it is up to the user to provide the configuration files over HTTP(S).
A special kernel parameter (`talos.config`) must be used to inform Talos about _where_ it should retreive its' configuration file.
To keep things simple we will place `init.yaml`, `controlplane.yaml`, and `join.yaml` into Matchbox's `assets` directory.
To keep things simple we will place `controlplane.yaml`, and `join.yaml` into Matchbox's `assets` directory.
This directory is automatically served by Matchbox.

### Create the Matchbox Configuration Files
Expand All @@ -53,33 +50,7 @@ Download these files from the [release](https://github.com/talos-systems/talos/r

#### Profiles

##### The Bootstrap Node

```json
{
"id": "init",
"name": "init",
"boot": {
"kernel": "/assets/vmlinuz",
"initrd": ["/assets/initramfs.xz"],
"args": [
"initrd=initramfs.xz",
"init_on_alloc=1",
"slab_nomerge",
"pti=on",
"console=tty0",
"console=ttyS0",
"printk.devkmsg=on",
"talos.platform=metal",
"talos.config=http://matchbox.talos.dev/assets/init.yaml"
]
}
}
```

> Note: Be sure to change `http://matchbox.talos.dev` to the endpoint of your matchbox server.
##### Additional Control Plane Nodes
##### Control Plane Nodes

```json
{
Expand All @@ -103,6 +74,8 @@ Download these files from the [release](https://github.com/talos-systems/talos/r
}
```

> Note: Be sure to change `http://matchbox.talos.dev` to the endpoint of your matchbox server.
##### Worker Nodes

```json
Expand Down Expand Up @@ -135,7 +108,7 @@ Now, create the following groups, and ensure that the `selector`s are accurate f
{
"id": "control-plane-1",
"name": "control-plane-1",
"profile": "init",
"profile": "control-plane",
"selector": {
...
}
Expand Down Expand Up @@ -177,12 +150,25 @@ Now, create the following groups, and ensure that the `selector`s are accurate f
Now that we have our configuraton files in place, boot all the machines.
Talos will come up on each machine, grab its' configuration file, and bootstrap itself.

### Retrieve the `kubeconfig`
### Bootstrap Etcd

At this point we can retrieve the admin `kubeconfig` by running:
Set the `endpoints` and `nodes`:

```bash
talosctl --talosconfig talosconfig config endpoint <control plane 1 IP>
talosctl --talosconfig talosconfig config node <control plane 1 IP>
```

Bootstrap `etcd`:

```bash
talosctl --talosconfig talosconfig bootstrap
```

### Retrieve the `kubeconfig`

At this point we can retrieve the admin `kubeconfig` by running:

```bash
talosctl --talosconfig talosconfig kubeconfig .
```
39 changes: 17 additions & 22 deletions website/content/docs/v0.11/Cloud Platforms/aws.md
Expand Up @@ -140,7 +140,6 @@ Using the DNS name of the loadbalancer created earlier, generate the base config

```bash
$ talosctl gen config talos-k8s-aws-tutorial https://<load balancer IP or DNS>:<port> --with-examples=false --with-docs=false
created init.yaml
created controlplane.yaml
created join.yaml
created talosconfig
Expand All @@ -155,8 +154,6 @@ Optionally, you can specify `--config-patch` with RFC6902 jsonpatch which will b
#### Validate the Configuration Files

```bash
$ talosctl validate --config init.yaml --mode cloud
init.yaml is valid for cloud mode
$ talosctl validate --config controlplane.yaml --mode cloud
controlplane.yaml is valid for cloud mode
$ talosctl validate --config join.yaml --mode cloud
Expand All @@ -168,26 +165,11 @@ join.yaml is valid for cloud mode
> Note: There is a known issue that prevents Talos from running on T2 instance types.
> Please use T3 if you need burstable instance types.
#### Create the Bootstrap Node

```bash
aws ec2 run-instances \
--region $REGION \
--image-id $AMI \
--count 1 \
--instance-type t3.small \
--user-data file://init.yaml \
--subnet-id $SUBNET \
--security-group-ids $SECURITY_GROUP \
--associate-public-ip-address \
--tag-specifications "ResourceType=instance,Tags=[{Key=Name,Value=talos-aws-tutorial-cp-0}]"
```

#### Create the Remaining Control Plane Nodes
#### Create the Control Plane Nodes

```bash
CP_COUNT=1
while [[ "$CP_COUNT" -lt 3 ]]; do
while [[ "$CP_COUNT" -lt 4 ]]; do
aws ec2 run-instances \
--region $REGION \
--image-id $AMI \
Expand Down Expand Up @@ -250,12 +232,25 @@ aws elbv2 create-listener \
--default-actions Type=forward,TargetGroupArn=$TARGET_GROUP_ARN
```

### Retrieve the `kubeconfig`
### Bootstrap Etcd

At this point we can retrieve the admin `kubeconfig` by running:
Set the `endpoints` and `nodes`:

```bash
talosctl --talosconfig talosconfig config endpoint <control plane 1 IP>
talosctl --talosconfig talosconfig config node <control plane 1 IP>
```

Bootstrap `etcd`:

```bash
talosctl --talosconfig talosconfig bootstrap
```

### Retrieve the `kubeconfig`

At this point we can retrieve the admin `kubeconfig` by running:

```bash
talosctl --talosconfig talosconfig kubeconfig .
```

0 comments on commit a71053f

Please sign in to comment.