libflexkube

module
v0.8.0-rc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2022 License: Apache-2.0

README

Certified Kubernetes logo Flexkube logo

libflexkube: Go library for deploying Kubernetes

Build Status Maintainability codecov GoDoc Go Report Card

Table of contents

Introduction

libflexkube is the core part of Flexkube project. It is a Go library, which implements the logic for managing Kubernetes cluster components (e.g. etcd, kubelet, certificates) and provides reference implementation of flexkube CLI tool and Terraform provider.

Flexkube is a minimalistic and flexible Kubernetes distribution, providing tools to manage each main Kubernetes component independently, which can be used together to create Kubernetes clusters.

Documentation

To see user documentation, visit flexkube.github.io. Please note, that the documentation is still in progress.

For development documentation, see docs.

Installation and usage

For quick examples of installation and usage, see the content below. For full documentation, see Getting started.

CLI tool

If you have go binary available in your system, you can start using Flexkube for creating Kubernetes certificates just by running the following commands:

echo 'pki:
  kubernetes: {}
  etcd: {}' > config.yaml
go run github.com/flexkube/libflexkube/cmd/flexkube pki

It will create config.yaml configuration file which will be consumed by flexkube CLI tool, which will then generate the certificates into state.yaml file.

Terraform

If you want to perform the same action using Terraform, execute the following commands:

cat <<EOF > main.tf
terraform {
  required_providers {
    flexkube = {
      source  = "flexkube/flexkube"
      version = "0.4.1"
    }
  }
}

resource "flexkube_pki" "pki" {
  etcd {}
  kubernetes {}
}
EOF
terraform init && terraform apply

After applying, Kubernetes certificates should be available as Terraform resource attributes of flexkube_pki.pki resource.

Next steps

For more detailed instructions of how to use Flexkube, see the user guides.

Characteristics

Flexkube project focuses on simplicity and tries to only do minimal amount of steps in order to get Kubernetes cluster running, while keeping the configuration flexible and extensible. It is also a good material for learning how Kubernetes cluster is set up, as each part of the cluster is managed independently and code contains a lot of comments why specific flag/option is needed and what purpose does it serve.

Parts of this project could possibly be used in other Kubernetes distributions or be used as a configuration reference, as setting up Kubernetes components requires many flags and configuration files to be created.

Flexkube do not manage infrastructure for running Kubernetes clusters, it must be provided by the user.

Features

Here is the short list of Flexkube project features:

  • Minimal host requirements - Use SSH connection forwarding for talking directly to the container runtime on remote machines for managing static containers and configuration files.
  • Independent management of etcd, kubelets, static control plane and self-hosted components.
  • All self-hosted control plane components managed using Helm 3 (e.g CoreDNS).
  • 1st class support for Terraform provider for automation.
  • No Public DNS or any other public discovery service is required for getting cluster up and running.
  • Others:
    • etcd, kubelet and static control plane running as containers.
    • Self-hosted control plane.
    • Supported container runtimes:
      • Docker
    • Configuration via YAML or via Terraform.
    • Deployment using CLI tools or via Terraform.
    • HAProxy for load-balancing and fail-over between Kubernetes API servers.

Known issues, missing features and limitations

As the project is still in the early stages, here is the list of major existing issues or missing features, which are likely to be implemented in the future:

  • gracefully replacing CA certificates (if private key does not change, it should work, but has not been tested)
  • no checkpointer for pods/apiserver. If static kube-apiserver container is stopped and node reboots, single node cluster will not come back.

And features, which are not yet implemented:

  • network policies for kube-system namespace
  • caching port forwarding
  • bastion host(s) support for SSH
  • parallel deployments across hosts
  • removal of configuration files, created data and containers
  • automatic shutdown/start of bootstrap control plane

Contributing

All contributions to this project are welcome. If it does not satisfy your needs, feel free to raise an issue about it or implement the support yourself and create a pull request with the patch, so we can all benefit from it.

If you just want to help the project grow and mature, there are many TODOs spread across the code, which should be addresses sooner or later.

Status of the project

At the time of writing, this project is in active development state and it is not suitable for production use. Breaking changes might be introduced at any point in time, for both library interface and for existing deployments.

Directories

Path Synopsis
cli
flexkube
Package flexkube contains logic of 'flexkube' CLI.
Package flexkube contains logic of 'flexkube' CLI.
cmd
internal
util
Package util provides very generic helpers used across codebase.
Package util provides very generic helpers used across codebase.
utiltest
Package utiltest provides testing helpers, for generating valid mock data like X509 certificates etc.
Package utiltest provides testing helpers, for generating valid mock data like X509 certificates etc.
pkg
apiloadbalancer
Package apiloadbalancer allows to create and manage kube-apiserver load balancer containers.
Package apiloadbalancer allows to create and manage kube-apiserver load balancer containers.
container
Package container allows to run and manage multiple containers across multiple hosts, by talking directly to the container runtime on local or remote hosts.
Package container allows to run and manage multiple containers across multiple hosts, by talking directly to the container runtime on local or remote hosts.
container/resource
Package resource stores a wrapper over container.Containers, which implements types.Resource interface.
Package resource stores a wrapper over container.Containers, which implements types.Resource interface.
container/runtime
Package runtime provides interfaces describing container runtimes in generic way and their functionality.
Package runtime provides interfaces describing container runtimes in generic way and their functionality.
container/runtime/docker
Package docker implements runtime.Interface and runtime.Config interfaces by talking to Docker API.
Package docker implements runtime.Interface and runtime.Config interfaces by talking to Docker API.
container/types
Package types contains types used for managing the containers.
Package types contains types used for managing the containers.
controlplane
Package controlplane allows to create and manage static Kubernetes controlplane running in containers.
Package controlplane allows to create and manage static Kubernetes controlplane running in containers.
defaults
Package defaults provides default values used across the library.
Package defaults provides default values used across the library.
etcd
Package etcd allows to create and manage etcd clusters.
Package etcd allows to create and manage etcd clusters.
helm/release
Package release allows to manage Helm 3 releases.
Package release allows to manage Helm 3 releases.
host
Package host collects all transport interface implementations and provides an unified configuration interface for these.
Package host collects all transport interface implementations and provides an unified configuration interface for these.
host/transport
Package transport provides interfaces for forwarding connections.
Package transport provides interfaces for forwarding connections.
host/transport/direct
Package direct is a transport.Interface implementation, which simply forwards given addresses "as is", without any modifications.
Package direct is a transport.Interface implementation, which simply forwards given addresses "as is", without any modifications.
host/transport/ssh
Package ssh is a transport.Interface implementation, which forwards given addresses over specified SSH host.
Package ssh is a transport.Interface implementation, which forwards given addresses over specified SSH host.
kubelet
Package kubelet implements logic needed for creating and managing kubelet instances running as containers.
Package kubelet implements logic needed for creating and managing kubelet instances running as containers.
kubernetes/client
Package client ships helper functions for building and using Kubernetes client.
Package client ships helper functions for building and using Kubernetes client.
pki
Package pki allows to manage Kubernetes PKI certificates.
Package pki allows to manage Kubernetes PKI certificates.
types
Package types provides reusable structs and interfaces used across libflexkube, which can also be used by external projects.
Package types provides reusable structs and interfaces used across libflexkube, which can also be used by external projects.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL