Skip to content

Commit b423b28

Browse files
authored
0.5.0 release updates (#101)
* Update documentation for 0.5.0 release * Update initialize_k0s.go * Update README.md * Update README.md * Try a bit different formatting * Finetune * More finetune * Update README.md * Update copyright * Update default version
1 parent 1ef1c5b commit b423b28

File tree

9 files changed

+194
-39
lines changed

9 files changed

+194
-39
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ The k0sctl binary will send anonymous telemetry when used.
194194
same "printed page" as the copyright notice for easier
195195
identification within third-party archives.
196196

197-
Copyright 2021, Mirantis Inc.
197+
Copyright 2021, k0sctl authors.
198198

199199
Licensed under the Apache License, Version 2.0 (the "License");
200200
you may not use this file except in compliance with the License.

README.md

Lines changed: 182 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,44 @@
22

33
*A command-line bootstrapping and management tool for [k0s zero friction kubernetes](https://k0sproject.io/) clusters.*
44

5+
Example output of k0sctl deploying a k0s cluster:
6+
7+
```sh
8+
$ k0sctl apply
9+
10+
⠀⣿⣿⡇⠀⠀⢀⣴⣾⣿⠟⠁⢸⣿⣿⣿⣿⣿⣿⣿⡿⠛⠁⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀█████████ █████████ ███
11+
⠀⣿⣿⡇⣠⣶⣿⡿⠋⠀⠀⠀⢸⣿⡇⠀⠀⠀⣠⠀⠀⢀⣠⡆⢸⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀███ ███ ███
12+
⠀⣿⣿⣿⣿⣟⠋⠀⠀⠀⠀⠀⢸⣿⡇⠀⢰⣾⣿⠀⠀⣿⣿⡇⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀███ ███ ███
13+
⠀⣿⣿⡏⠻⣿⣷⣤⡀⠀⠀⠀⠸⠛⠁⠀⠸⠋⠁⠀⠀⣿⣿⡇⠈⠉⠉⠉⠉⠉⠉⠉⠉⢹⣿⣿⠀███ ███ ███
14+
⠀⣿⣿⡇⠀⠀⠙⢿⣿⣦⣀⠀⠀⠀⣠⣶⣶⣶⣶⣶⣶⣿⣿⡇⢰⣶⣶⣶⣶⣶⣶⣶⣶⣾⣿⣿⠀█████████ ███ ██████████
15+
16+
INFO By continuing to use k0sctl you agree to these terms:
17+
INFO https://k0sproject.io/licenses/eula
18+
INFO ==> Running phase: Connect to hosts
19+
INFO ==> Running phase: Detect host operating systems
20+
INFO [ssh] 10.0.0.1:22: is running Ubuntu 20.10
21+
INFO [ssh] 10.0.0.2:22: is running Ubuntu 20.10
22+
INFO ==> Running phase: Prepare hosts
23+
INFO ==> Running phase: Gather host facts
24+
INFO [ssh] 10.0.0.1:22: discovered 10.12.18.133 as private address
25+
INFO ==> Running phase: Validate hosts
26+
INFO ==> Running phase: Gather k0s facts
27+
INFO ==> Running phase: Download k0s binaries on hosts
28+
INFO ==> Running phase: Configure k0s
29+
INFO [ssh] 10.0.0.1:22: validating configuration
30+
INFO ==> Running phase: Initialize the k0s cluster
31+
INFO [ssh] 10.0.0.1:22: installing k0s controller
32+
INFO ==> Running phase: Install workers
33+
INFO [ssh] 10.0.0.1:22: generating token
34+
INFO [ssh] 10.0.0.2:22: installing k0s worker
35+
INFO [ssh] 10.0.0.2:22: waiting for node to become ready
36+
INFO ==> Running phase: Disconnect from hosts
37+
INFO ==> Finished in 2m2s
38+
INFO k0s cluster version 0.11.0 is now installed
39+
INFO Tip: To access the cluster you can now fetch the admin kubeconfig using:
40+
INFO k0sctl kubeconfig
41+
```
42+
543
## Installation
644

745
### Install from the released binaries
@@ -14,7 +52,7 @@ As the released binaries aren't signed yet, on macOS and Windows, you must first
1452

1553
If you have a working Go toolchain, you can use `go get` to install k0sctl to your `$GOPATH/bin`.
1654

17-
```
55+
```sh
1856
$ GO111MODULE=on go get github.com/k0sproject/k0sctl
1957
```
2058

@@ -26,31 +64,53 @@ Scripts for installation via popular package managers such as Homebrew, Scoop or
2664

2765
K0sctl is still in an early stage of development. Missing major features include at least:
2866

29-
* Cluster upgrades are not yet possible
3067
* Windows targets are not yet supported
3168
* The released binaries have not been signed
32-
* Cluster uninstall and host clean up after failure is not there yet
3369
* Cluster backup and restore are not available yet
70+
* Nodes can't be removed
3471

3572
## Usage
3673

37-
The main function of k0sctl is the `k0sctl apply` subcommand. Provided a configuration file, k0sctl will connect to the listed hosts and install k0s on them.
74+
### `k0sctl apply`
75+
76+
The main function of k0sctl is the `k0sctl apply` subcommand. Provided a configuration file describing the desired cluster state, k0sctl will connect to the listed hosts, determines the current state of the hosts and configures them as needed to form a k0s cluster.
3877

3978
The default location for the configuration file is `k0sctl.yaml` in the current working directory. To load a configuration from a different location, use:
4079

41-
```
80+
```sh
4281
$ k0sctl apply --config path/to/k0sctl.yaml
4382
```
4483

45-
## Configuration file syntax
84+
If the configuration cluster version `spec.k0s.version` is greater than the version detected on the cluster, a cluster upgrade will be performed. If the configuration lists hosts that are not part of the cluster, they will be configured to run k0s and will be joined to the cluster.
4685

47-
To generate a simple skeleton configuration file, you can use the `k0sctl init` subcommand:
86+
### `k0sctl init`
4887

49-
```
50-
$ k0sctl init > k0sctl.yaml
88+
Generate a configuration template. Use `--k0s` to include an example `spec.k0s.config` k0s configuration block.
89+
90+
### `k0sctl reset`
91+
92+
Uninstall k0s from the hosts listed in the configuration.
93+
94+
### `k0sctl kubeconfig`
95+
96+
Connects to the cluster and outputs a kubeconfig file that can be used with `kubectl` or `kubeadm` to manage the kubernetes cluster.
97+
98+
Example:
99+
100+
```sh
101+
$ k0sctl kubeconfig --config path/to/k0sctl.yaml > k0s.config
102+
$ kubectl get node --kubeconfig k0s.config
103+
NAME STATUS ROLES AGE VERSION
104+
worker0 NotReady <none> 10s v1.20.2-k0s1
51105
```
52106

53-
### Example configuration
107+
## Configuration file
108+
109+
The configuration file is in YAML format and loosely resembles the syntax used in Kubernetes. YAML anchors and aliases can be used.
110+
111+
To generate a simple skeleton configuration file, you can use the `k0sctl init` subcommand.
112+
113+
Configuration example:
54114

55115
```yaml
56116
apiVersion: k0sctl.k0sproject.io/v1beta1
@@ -68,7 +128,6 @@ spec:
68128
- role: worker
69129
ssh:
70130
address: 10.0.0.2
71-
user: root
72131
k0s:
73132
version: 0.10.0
74133
instalFlags:
@@ -85,21 +144,115 @@ spec:
85144
version: v3.16.2
86145
```
87146
88-
### Configuration file `spec` fields
89-
90-
* `hosts` A list of target hosts
91-
* `role` One of `controller`, `worker` or if you want the controller to run workloads, use `controller+worker`
92-
* `uploadBinary` When set to `true`, instead of having the hosts download the k0s binaries from the internet, k0sctl will download them to the local storage and upload to the target hosts
93-
* `k0sBinaryPath` Upload a k0s binary from a local path to the host, useful for running a locally compiled development version
94-
* `installFlags` A list of extra arguments passed to the `k0s install` command. See [k0s install command documentation](https://docs.k0sproject.io/main/cli/k0s_install/) for details
95-
* `environment` A mapping of `string: value` pairs for setting the host's environment variables
96-
* `ssh` SSH connection parameters
97-
* `address` IP address or hostname of the remote host
98-
* `port` SSH port, default is 22.
99-
* `keyPath` Path to a SSH private key file, default is `~/.ssh/id_rsa`
100-
* `user` Username to connect as, the default is `root`
101-
* `localhost` You can use the local host that is running k0sctl as a cluster node
102-
* `enabled` Set this to true to enable the localhost connection. You can leave out the SSH configuration
103-
* `k0s` K0s options
104-
* `version` Target k0s version. Default is to use the latest released version
105-
* `config` An embedded k0s cluster configuration. See [k0s configuration documentation](https://docs.k0sproject.io/main/configuration/) for details
147+
### Configuration Header Fields
148+
149+
###### `apiVersion` &lt;string&gt; (required)
150+
151+
The configuration file syntax version. Currently the only supported version is `k0sctl.k0sproject.io/v1beta1`.
152+
153+
###### `kind` &lt;string&gt; (required)
154+
155+
In the future, some of the configuration APIs can support multiple types of objects. For now, the only supported kind is `Cluster`.
156+
157+
###### `spec` &lt;mapping&gt; (required)
158+
159+
The main object definition, see [below](#configuration-spec)
160+
161+
###### `metadata` &lt;mapping&gt; (optional)
162+
163+
Information that can be used to uniquely identify the object.
164+
165+
Example:
166+
167+
```yaml
168+
metadata:
169+
name: k0s-cluster-name
170+
```
171+
172+
### Spec Fields
173+
174+
##### `spec.hosts` &lt;sequence&gt; (required)
175+
176+
A list of cluster hosts. Host requirements:
177+
178+
* Currently only linux targets are supported
179+
* The user must either be root or have passwordless `sudo` access.
180+
* The host must fulfill the k0s system requirements
181+
182+
See [host object documentation](#host-fields) below.
183+
184+
##### `spec.k0s` &lt;mapping&gt; (optional)
185+
186+
Settings related to the k0s cluster.
187+
188+
See [k0s object documentation](#spec-fields) below.
189+
190+
### Host Fields
191+
192+
###### `spec.hosts[*].role` &lt;string&gt; (required)
193+
194+
One of `controller`, `worker` or to set up a controller that can also run workloads, use `controller+worker`.
195+
196+
###### `spec.hosts[*].uploadBinary` &lt;boolean&gt; (optional) (default: `false`)
197+
198+
When `true`, the k0s binaries for target host will be downloaded and cached on the local host and uploaded to the target.
199+
When `false`, the k0s binary downloading is performed on the target host itself
200+
201+
###### `spec.hosts[*].k0sBinaryPath` &lt;string&gt; (optional)
202+
203+
A path to a file on the local host that contains a k0s binary to be uploaded to the host. Can be used to test drive a custom development build of k0s.
204+
205+
###### `spec.hosts[*].installFlags` &lt;sequence&gt; (optional)
206+
207+
Extra flags passed to the `k0s install` command on the target host. See `k0s install --help` for a list of options.
208+
209+
###### `spec.hosts[*].environment` &lt;mapping&gt; (optional)
210+
211+
List of key-value pairs to set to the target host's environment variables.
212+
213+
Example:
214+
215+
```yaml
216+
environment:
217+
HTTP_PROXY: 10.0.0.1:443
218+
```
219+
220+
##### `spec.hosts[*].ssh` &lt;mapping&gt; (optional)
221+
222+
SSH connection options.
223+
224+
###### `spec.hosts[*].ssh.address` &lt;string&gt; (required)
225+
226+
IP address of the host
227+
228+
###### `spec.hosts[*].ssh.user` &lt;string&gt; (optional) (default: `root`)
229+
230+
Username to log in as.
231+
232+
###### `spec.hosts[*].ssh.port` &lt;string&gt; (required)
233+
234+
TCP port of the SSH service on the host.
235+
236+
###### `spec.hosts[*].ssh.keyPath` &lt;string&gt; (optional) (default: `~/.ssh/id_rsa`)
237+
238+
Path to a SSH private key file.
239+
240+
##### `spec.hosts[*].localhost` &lt;mapping&gt; (optional)
241+
242+
Localhost connection options. Can be used to use the local host running k0sctl as a node in the cluster.
243+
244+
###### `spec.hosts[*].localhost.enabled` &lt;boolean&gt; (optional) (default: `false`)
245+
246+
This must be set `true` to enable the localhost connection.
247+
248+
### K0s Fields
249+
250+
##### `spec.k0s.version` &lt;string&gt; (optional) (default: auto-discovery)
251+
252+
The version of k0s to deploy. When left out, k0sctl will default to using the latest released version of k0s or the version already running on the cluster.
253+
254+
##### `spec.k0s.config` &lt;mapping&gt; (optional) (default: auto-generated)
255+
256+
Embedded k0s cluster configuration. See [k0s configuration documentation](https://docs.k0sproject.io/main/configuration/) for details.
257+
258+
When left out, the output of `k0s default-config` will be used.

cmd/flags.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,11 @@ func initConfig(ctx *cli.Context) error {
8383
return ctx.Set("config", string(content))
8484
}
8585

86-
func displayCopyright(_ *cli.Context) error {
87-
fmt.Printf("k0sctl %s Copyright 2021, Mirantis Inc.\n", version.Version)
88-
fmt.Println("Anonymized telemetry will be sent to Mirantis.")
86+
func displayCopyright(ctx *cli.Context) error {
87+
fmt.Printf("k0sctl %s Copyright 2021, k0sctl authors.\n", version.Version)
88+
if !ctx.Bool("disable-telemetry") {
89+
fmt.Println("Anonymized telemetry of usage will be sent to the authors.")
90+
}
8991
fmt.Println("By continuing to use k0sctl you agree to these terms:")
9092
fmt.Println("https://k0sproject.io/licenses/eula")
9193
return nil

examples/footloose/k0sctl.yaml.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ spec:
1111
address: 127.0.0.1
1212
port: 9023
1313
k0s:
14-
version: 0.11.0-beta1
14+
version: 0.11.0

phase/configure_k0s.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ type ConfigureK0s struct {
1919

2020
// Title returns the phase title
2121
func (p *ConfigureK0s) Title() string {
22-
return "Configure K0s"
22+
return "Configure k0s"
2323
}
2424

2525
// Run the phase

phase/download_binaries.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ type DownloadBinaries struct {
2121

2222
// Title for the phase
2323
func (p *DownloadBinaries) Title() string {
24-
return "Download binaries"
24+
return "Download k0s binaries to local host"
2525
}
2626

2727
// Prepare the phase

phase/download_k0s.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ type DownloadK0s struct {
1717

1818
// Title for the phase
1919
func (p *DownloadK0s) Title() string {
20-
return "Download K0s on the hosts"
20+
return "Download k0s on hosts"
2121
}
2222

2323
// Prepare the phase

phase/initialize_k0s.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ type InitializeK0s struct {
1414

1515
// Title for the phase
1616
func (p *InitializeK0s) Title() string {
17-
return "Initialize K0s Cluster"
17+
return "Initialize the k0s cluster"
1818
}
1919

2020
// Prepare the phase

phase/upload_binaries.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ type UploadBinaries struct {
1414

1515
// Title for the phase
1616
func (p *UploadBinaries) Title() string {
17-
return "Upload binaries"
17+
return "Upload k0s binaries to hosts"
1818
}
1919

2020
// Prepare the phase

0 commit comments

Comments
 (0)