kubefed

module
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2022 License: Apache-2.0

README

Github Actions Go Report Card Image Repository on Quay LICENSE Releases

Kubernetes Cluster Federation

Kubernetes Cluster Federation (KubeFed for short) allows you to coordinate the configuration of multiple Kubernetes clusters from a single set of APIs in a hosting cluster. KubeFed aims to provide mechanisms for expressing which clusters should have their configuration managed and what that configuration should be. The mechanisms that KubeFed provides are intentionally low-level, and intended to be foundational for more complex multicluster use cases such as deploying multi-geo applications and disaster recovery.

KubeFed is currently beta.

Concepts

KubeFed is configured with two types of information:

  • Type configuration declares which API types KubeFed should handle
  • Cluster configuration declares which clusters KubeFed should target

Propagation refers to the mechanism that distributes resources to federated clusters.

Type configuration has three fundamental concepts:

  • Templates define the representation of a resource common across clusters
  • Placement defines which clusters the resource is intended to appear in
  • Overrides define per-cluster field-level variation to apply to the template

These three abstractions provide a concise representation of a resource intended to appear in multiple clusters. They encode the minimum information required for propagation and are well-suited to serve as the glue between any given propagation mechanism and higher-order behaviors like policy-based placement and dynamic scheduling.

These fundamental concepts provide building blocks that can be used by higher-level APIs:

  • Status collects the status of resources distributed by KubeFed across all federated clusters
  • Policy determines which subset of clusters a resource is allowed to be distributed to
  • Scheduling refers to a decision-making capability that can decide how workloads should be spread across different clusters similar to how a human operator would

Features

Feature Maturity Feature Gate Default
Push propagation of arbitrary types to remote clusters Alpha PushReconciler true
CLI utility (kubefedctl) Alpha
Generate KubeFed APIs without writing code Alpha
Replica Scheduling Preferences Alpha SchedulerPreferences true

Guides

Quickstart
  1. Clone this repo:
    git clone https://github.com/kubernetes-sigs/kubefed.git
    
  2. Start a kind cluster:
    kind create cluster
    
  3. Deploy kubefed:
    make deploy.kind
    

You now have a Kubernetes cluster with kubefed up and running. The cluster has been joined to itself and you can test federation of resources like this:

  1. Verify the KubeFedCluster exists and is ready:
    kubectl -n kube-federation-system get kubefedcluster
    
    If you're on macOS the cluster will not immediately show as ready. You need to change the API endpoint's URL first:
    ./scripts/fix-joined-kind-clusters.sh
    
  2. Create a namespace to be federated:
    kubectl create ns federate-me
    
  3. Tell kubefed to federate that namespace (and the resources in it):
    ./bin/kubefedctl federate ns federate-me
    
  4. Create a ConfigMap to be federated:
    kubectl -n federate-me create cm my-cm
    
  5. Tell kubefed to federate that ConfigMap:
    ./bin/kubefedctl -n federate-me federate configmap my-cm
    
  6. Verify the FederatedConfigMap has been created and propagates properly:
    kubectl -n federate-me describe federatedconfigmap my-cm
    
User Guide

Take a look at our user guide if you are interested in using KubeFed.

Development Guide

Take a look at our development guide if you are interested in contributing.

Community

Refer to the contributing guidelines if you would like to contribute to KubeFed.

Communication channels

KubeFed is sponsored by SIG Multicluster and it uses the same communication channels as SIG multicluster.

Code of Conduct

Participation in the Kubernetes community is governed by the Kubernetes Code of Conduct.

Directories

Path Synopsis
cmd
controller-manager/app/options
Package options contains flags and options for initializing controller-manager
Package options contains flags and options for initializing controller-manager
hyperfed
A binary that can morph into all of the other kubefed binaries.
A binary that can morph into all of the other kubefed binaries.
kubefedctl
kubefedctl is a tool for managing a KubeFed control plane.
kubefedctl is a tool for managing a KubeFed control plane.
pkg
apis
Package apis contains Kubernetes API groups.
Package apis contains Kubernetes API groups.
apis/core
Package core contains core API versions
Package core contains core API versions
apis/core/v1alpha1
Package v1alpha1 contains API Schema definitions for the core v1alpha1 API group +kubebuilder:object:generate=true +groupName=core.kubefed.io
Package v1alpha1 contains API Schema definitions for the core v1alpha1 API group +kubebuilder:object:generate=true +groupName=core.kubefed.io
apis/core/v1beta1
Package v1beta1 contains API Schema definitions for the core v1beta1 API group +kubebuilder:object:generate=true +groupName=core.kubefed.io
Package v1beta1 contains API Schema definitions for the core v1beta1 API group +kubebuilder:object:generate=true +groupName=core.kubefed.io
apis/scheduling
Package scheduling contains scheduling API versions
Package scheduling contains scheduling API versions
apis/scheduling/v1alpha1
Package v1alpha1 contains API Schema definitions for the scheduling v1alpha1 API group +kubebuilder:object:generate=true +groupName=scheduling.kubefed.io
Package v1alpha1 contains API Schema definitions for the scheduling v1alpha1 API group +kubebuilder:object:generate=true +groupName=scheduling.kubefed.io
controller/util
TODO: consider moving it to a more generic package.
TODO: consider moving it to a more generic package.
controller/util/finalizers
Helper functions for manipulating finalizers.
Helper functions for manipulating finalizers.
test
common
Package common generated by go-bindata.// sources: test/common/fixtures/clusterroles.rbac.authorization.k8s.io.yaml test/common/fixtures/configmaps.yaml test/common/fixtures/deployments.apps.yaml test/common/fixtures/ingresses.networking.k8s.io.yaml test/common/fixtures/jobs.batch.yaml test/common/fixtures/namespaces.yaml test/common/fixtures/replicasets.apps.yaml test/common/fixtures/secrets.yaml test/common/fixtures/serviceaccounts.yaml test/common/fixtures/services.yaml config/kubefedconfig.yaml config/enabletypedirectives/clusterroles.rbac.authorization.k8s.io.yaml config/enabletypedirectives/configmaps.yaml config/enabletypedirectives/deployments.apps.yaml config/enabletypedirectives/ingresses.networking.k8s.io.yaml config/enabletypedirectives/jobs.batch.yaml config/enabletypedirectives/namespaces.yaml config/enabletypedirectives/replicasets.apps.yaml config/enabletypedirectives/secrets.yaml config/enabletypedirectives/serviceaccounts.yaml config/enabletypedirectives/services.yaml
Package common generated by go-bindata.// sources: test/common/fixtures/clusterroles.rbac.authorization.k8s.io.yaml test/common/fixtures/configmaps.yaml test/common/fixtures/deployments.apps.yaml test/common/fixtures/ingresses.networking.k8s.io.yaml test/common/fixtures/jobs.batch.yaml test/common/fixtures/namespaces.yaml test/common/fixtures/replicasets.apps.yaml test/common/fixtures/secrets.yaml test/common/fixtures/serviceaccounts.yaml test/common/fixtures/services.yaml config/kubefedconfig.yaml config/enabletypedirectives/clusterroles.rbac.authorization.k8s.io.yaml config/enabletypedirectives/configmaps.yaml config/enabletypedirectives/deployments.apps.yaml config/enabletypedirectives/ingresses.networking.k8s.io.yaml config/enabletypedirectives/jobs.batch.yaml config/enabletypedirectives/namespaces.yaml config/enabletypedirectives/replicasets.apps.yaml config/enabletypedirectives/secrets.yaml config/enabletypedirectives/serviceaccounts.yaml config/enabletypedirectives/services.yaml
e2e
e2e/framework/ginkgowrapper
Package ginkgowrapper wraps Ginkgo Fail and Skip functions to panic with structured data instead of a constant string.
Package ginkgowrapper wraps Ginkgo Fail and Skip functions to panic with structured data instead of a constant string.

Jump to

Keyboard shortcuts

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