-
Notifications
You must be signed in to change notification settings - Fork 361
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #909 from ncopa/kube-1.21.1
Kube 1.21.1 cherry-picks for release-1.21
- Loading branch information
Showing
35 changed files
with
963 additions
and
278 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
Copyright 2021 k0s authors | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
package start | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
|
||
"github.com/k0sproject/k0s/pkg/install" | ||
"github.com/kardianos/service" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func NewStartCmd() *cobra.Command { | ||
return &cobra.Command{ | ||
Use: "start", | ||
Short: "Start the k0s service configured on this host. Must be run as root (or with sudo)", | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
if os.Geteuid() != 0 { | ||
return fmt.Errorf("this command must be run as root") | ||
} | ||
svc, err := install.InstalledService() | ||
if err != nil { | ||
return err | ||
} | ||
status, _ := svc.Status() | ||
if status == service.StatusRunning { | ||
cmd.SilenceUsage = true | ||
return fmt.Errorf("already running") | ||
} | ||
return svc.Start() | ||
}, | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
Copyright 2021 k0s authors | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
package stop | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
|
||
"github.com/k0sproject/k0s/pkg/install" | ||
"github.com/kardianos/service" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func NewStopCmd() *cobra.Command { | ||
return &cobra.Command{ | ||
Use: "stop", | ||
Short: "Stop the k0s service configured on this host. Must be run as root (or with sudo)", | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
if os.Geteuid() != 0 { | ||
return fmt.Errorf("this command must be run as root") | ||
} | ||
svc, err := install.InstalledService() | ||
if err != nil { | ||
return err | ||
} | ||
status, err := svc.Status() | ||
if err != nil { | ||
return err | ||
} | ||
if status == service.StatusStopped { | ||
cmd.SilenceUsage = true | ||
return fmt.Errorf("already stopped") | ||
} | ||
return svc.Stop() | ||
}, | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,6 @@ type CmdOpts config.CLIOptions | |
|
||
var ( | ||
tokenExpiry string | ||
tokenRole string | ||
waitCreate bool | ||
) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,39 @@ | ||
# Architecture | ||
|
||
**Note:** As with any young project, things change rapidly. Thus all the details in this architecture documentation may not be always up-to-date, but the high level concepts and patterns should still apply. | ||
**Note:** As k0s is a new and dynamic project, the product architecture may occasionally outpace the documentation. The high level concepts and patterns, however, should always apply. | ||
|
||
## Packaging | ||
|
||
k0s is packaged as single, self-extracting binary which embeds Kubernetes binaries. This has many benefits: | ||
- Everything can be, and is, statically compiled | ||
- No OS level deps | ||
- No RPMs, dep's, snaps or any other OS specific packaging needed. Single "package" for all OSes | ||
- We can fully control the versions of each and every dependency | ||
The k0s package is a single, self-extracting binary that embeds Kubernetes binaries, the benefits of which include: | ||
|
||
- Statically compiled | ||
- No OS-level dependencies | ||
- Requires no RPMs, dependencies, snaps, or any other OS-specific packaging | ||
- Provides a single package for all operating systems | ||
- Allows full version control for each dependency | ||
|
||
![k0s packaging as a single binary](img/k0s_packaging.png) | ||
|
||
## Control plane | ||
|
||
k0s as a single binary acts as the process supervisor for all other control plane components. This means there's no container engine or kubelet running on controllers (by default). Which means there is no way for a cluster user to schedule workloads onto controller nodes. | ||
As a single binary, k0s acts as the process supervisor for all other control plane components. As such, there is no container engine or kubelet running on controllers by default, which thus means that a cluster user cannot schedule workloads onto controller nodes. | ||
|
||
![k0s Controller processes](img/k0s_controller_processes.png) | ||
|
||
k0s creates, manages and configures each of the components. k0s runs all control plane components as "naked" processes. So on the controller node there's no container engine running. | ||
Using k0s you can create, manage, and configure each of the components, running each as a "naked" process. Thus, there is no container engine running on the controller node. | ||
|
||
### Storage | ||
## Storage | ||
|
||
Typically Kubernetes control plane supports only etcd as the datastore. In addition to etcd, k0s supports many other datastore options. This is achieved by including [kine](https://github.com/rancher/kine/). Kine allows wide variety of backend data stores to be used such as MySQL, PostgreSQL, SQLite and dqlite. See more in storage [documentation](configuration.md#specstorage) | ||
Kubernetes control plane typically supports only etcd as the datastore. k0s, however, supports many other datastore options in addition to etcd, which it achieves by including [kine](https://github.com/rancher/kine/). Kine allows the use of a wide variety of backend data stores, such as MySQL, PostgreSQL, SQLite, and dqlite (refer to the [`spec.storage` documentation](configuration.md#specstorage)). | ||
|
||
In case of k0s managed etcd, k0s manages the full lifecycle of the etcd cluster. This means for example that by joining a new controller node with `k0s controller "long-join-token"` k0s will automatically adjust the etcd cluster membership info to allow the new member to join the cluster. | ||
In the case of k0s managed etcd, k0s manages the full lifecycle of the etcd cluster. For example, by joining a new controller node with `k0s controller "long-join-token"` k0s atomatically adjusts the etcd cluster membership info to allow the new member to join the cluster. | ||
|
||
**Note:** Currently k0s cannot shrink the etcd cluster. For now user needs to manually remove the etcd member and only after that shutdown the k0s controller on the removed node. | ||
**Note**: k0s cannot shrink the etcd cluster. As such, to shut down the k0s controller on a node that node must first be manually removed from the etcd cluster. | ||
|
||
## Worker node | ||
|
||
![k0s worker processes](img/k0s_worker_processes.png) | ||
|
||
Like for the control plane, k0s creates and manages the core worker components as naked processes on the worker node. | ||
As with the control plane, with k0s you can create and manage the core worker components as naked processes on the worker node. | ||
|
||
By default, k0s workers use [containerd](https://containerd.io) as a high-level runtime and [runc](https://github.com/opencontainers/runc) as a low-level runtime. Custom runtimes are also supported as described [here](custom-cri-runtime.md). | ||
By default, k0s workers use [containerd](https://containerd.io) as a high-level runtime and [runc](https://github.com/opencontainers/runc) as a low-level runtime. Custom runtimes are also supported (refer to [Custom CRI runtime](custom-cri-runtime.md)). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
## k0s start | ||
|
||
Start the k0s service after it has been installed using `k0s install`. Must be run as root (or with sudo), | ||
|
||
### Options | ||
|
||
``` | ||
-h, --help help for start | ||
``` | ||
|
||
### Options inherited from parent commands | ||
|
||
``` | ||
-d, --debug Debug logging (default: false) | ||
``` | ||
|
||
### SEE ALSO | ||
|
||
* [k0s stop](k0s_stop.md) - Stop the k0s service after it has been installed using `k0s install`. Must be run as root (or with sudo) | ||
* [k0s install](k0s_install.md) - Helper command for setting up k0s on a brand-new system. Must be run as root (or with sudo) | ||
* [k0s install controller](k0s_install_controller.md) - Helper command for setting up k0s as controller node on a brand-new system. Must be run as root (or with sudo) | ||
* [k0s install worker](k0s_install_worker.md) - Helper command for setting up k0s as a worker node on a brand-new system. Must be run as root (or with sudo) |
Oops, something went wrong.