You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
+
5
43
## Installation
6
44
7
45
### Install from the released binaries
@@ -14,7 +52,7 @@ As the released binaries aren't signed yet, on macOS and Windows, you must first
14
52
15
53
If you have a working Go toolchain, you can use `go get` to install k0sctl to your `$GOPATH/bin`.
16
54
17
-
```
55
+
```sh
18
56
$ GO111MODULE=on go get github.com/k0sproject/k0sctl
19
57
```
20
58
@@ -26,31 +64,53 @@ Scripts for installation via popular package managers such as Homebrew, Scoop or
26
64
27
65
K0sctl is still in an early stage of development. Missing major features include at least:
28
66
29
-
* Cluster upgrades are not yet possible
30
67
* Windows targets are not yet supported
31
68
* The released binaries have not been signed
32
-
* Cluster uninstall and host clean up after failure is not there yet
33
69
* Cluster backup and restore are not available yet
70
+
* Nodes can't be removed
34
71
35
72
## Usage
36
73
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.
38
77
39
78
The default location for the configuration file is `k0sctl.yaml` in the current working directory. To load a configuration from a different location, use:
40
79
41
-
```
80
+
```sh
42
81
$ k0sctl apply --config path/to/k0sctl.yaml
43
82
```
44
83
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.
46
85
47
-
To generate a simple skeleton configuration file, you can use the `k0sctl init` subcommand:
86
+
### `k0sctl init`
48
87
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.
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:
54
114
55
115
```yaml
56
116
apiVersion: k0sctl.k0sproject.io/v1beta1
@@ -68,7 +128,6 @@ spec:
68
128
- role: worker
69
129
ssh:
70
130
address: 10.0.0.2
71
-
user: root
72
131
k0s:
73
132
version: 0.10.0
74
133
instalFlags:
@@ -85,21 +144,115 @@ spec:
85
144
version: v3.16.2
86
145
```
87
146
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` <string> (required)
150
+
151
+
The configuration file syntax version. Currently the only supported version is `k0sctl.k0sproject.io/v1beta1`.
152
+
153
+
###### `kind` <string> (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` <mapping> (required)
158
+
159
+
The main object definition, see [below](#configuration-spec)
160
+
161
+
###### `metadata` <mapping> (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` <sequence> (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` <mapping> (optional)
185
+
186
+
Settings related to the k0s cluster.
187
+
188
+
See [k0s object documentation](#spec-fields) below.
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.
0 commit comments