A Kubernetes controller that automatically adds a label (k8c.io/uses-container-linux
)
to Nodes running Flatcar Container Linux as their base operating system. Nodes are detected by checking
for the string "flatcar" in the operating system name.
- Watch k8s node objects
- Check for nodes using Flatcar Container Linux.
- Attach a label (
k8c.io/uses-container-linux:'true'
) to the Node if it uses FC Linux. - Write a Dockerfile for the controller
- Write a Kubernetes Deployment for the controller
- Write the RBAC manifests required for the controller
Clone the repo and in the node-label-controller
folder, build the application binary by running:
make build
The command will generate the executable in $PWD/build/fct
.
Next, run ./build/fct
to watch the nodes in your cluster.
In out-of-cluster mode, fct
will prioritize the value of your $KUBECONFIG
environment variable over $HOME/.kube/config
. As a result, you can run it on your choice
cluster by setting $KUBECONFIG
appropriately.
Install fct
in a cluster by running:
make install
The above command will:
- create a service account named
fct-sa
for the controller to use. - a cluster role with permissions to {get, list, watch, and patch} nodes in the cluster.
- create a cluster role-binding that binds the service account to the cluster role.
- apply the fct-deployment that is based on the
idoko/fct
docker image.
You can remove the controller from the cluster by running:
make uninstall
The controller works against:
- a fake cluster (using the unit tests in
pkg/controller/controller_test.go
)