/k3s

Chef cookbook to install k3s.

Primary LanguageRubyApache License 2.0Apache-2.0

k3s

Chef cookbook to install K3s using MariaDB as a Cluster Datastore.

Getting Started

This cookbook requires a running MariaDB instance to use as a backend for K3s. See the mariadb cookbook for examples of how to setup a standalone or Galera instance.

Resources

k3s_install

The k3s_install resource is responsible for fetching and running a Terraform Cloud Agent docker image.

Actions

default_action :run

  • :create - Pulls the container image.
  • :remove - Removes the cached image.

Properties

  • disable - Array of components to disable/not deploy.
  • disable_cloud_controller - Boolean to disable the default cloud controller manager. Defaults to false.
  • datastore - Cluster Datastore to use, at the moment only mariadb is supported. Defaults to mariadb.
  • kubeconfig_mode - kube config file mode. Defaults to 0644.
  • kubelet_args - Array of customised flags for the kubelet process.
  • mariadb_database - MariaDB database to use. Defaults to k3s.
  • mariadb_user - MariaDB username used by k3s. Defaults to k3s.
  • mariadb_password - MariaDB password used by k3s. Defaults to k3s.
  • mariadb_host - MariaDB host to use. Defaults to localhost.
  • node_labels - Array of key=value pairs to apply as node labels.
  • snapshotter - Set to override the default containerd snapshotter.
  • tls_san - Additional TLS SAN(s); can be specified either as an array or string.

Examples

Minimal usage:

k3s_install 'server'

Using non-default MariaDB settings:

k3s_install 'server' do
  mariadb_user     'k3s'
  mariadb_password 'p4ssw0rd'
  mariadb_host     'db.local'
end

Specifying custom node labels and additional TLS SAN:

k3s_install 'server' do
  node_labels ['foo=bar', 'something=amazing']
  tls_san     'k3s.example.com'
end

Versioning

This cookbook uses Semantic Versioning 2.0.0.

Given a version number MAJOR.MINOR.PATCH, increment the:

  • MAJOR version when you make functional cookbook changes,
  • MINOR version when you add functionality in a backwards-compatible manner,
  • PATCH version when you make backwards-compatible bug fixes.

Contributing

We welcome contributed improvements and bug fixes via the usual work flow:

  1. Fork this repository
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new pull request

License and Authors

Authors and contributors:

Copyright 2020 Stephen Hoekstra <stephenhoekstra@gmail.com>
Copyright 2020 Schuberg Philis

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.