Make sure the following conditions are met:
- A Kubernetes cluster with version 1.26 or newer is running. Learn how to install the Kubernetes tools. For any clusters with version lower than 1.27, we need to enable the feature gate for
Start Ordinal
, see https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#start-ordinal - Your cluster has at least 1 node with 1+ CPUs and 1G of memory available for the LeaderWorkerSet controller manager Deployment to run on. NOTE: On some cloud providers, the default node machine type will not have sufficient resources to run the LeaderWorkerSet controller manager and all the required kube-system pods, so you'll need to use a larger machine type for your nodes.
- The kubectl command-line tool has communication with your cluster.
To install a released version of LeaderWorkerSet in your cluster, run the following command:
VERSION=v0.4.0
kubectl apply --server-side -f https://github.com/kubernetes-sigs/lws/releases/download/$VERSION/manifests.yaml
To uninstall a released version of LeaderWorkerSet from your cluster, run the following command:
VERSION=v0.4.0
kubectl delete -f https://github.com/kubernetes-sigs/lws/releases/download/$VERSION/manifests.yaml
To install the latest development version of LeaderWorkerSet in your cluster, run the following command:
kubectl apply --server-side -k github.com/kubernetes-sigs/lws/config/default?ref=main
The controller runs in the lws-system
namespace.
To uninstall LeaderWorkerSet, run the following command:
kubectl delete -k github.com/kubernetes-sigs/lws/config/default
To build LeaderWorkerSet from source and install LeaderWorkerSet in your cluster, run the following commands:
git clone https://github.com/kubernetes-sigs/lws.git
cd lws
IMAGE_REGISTRY=<registry>/<project> make image-push deploy
To uninstall LeaderWorkerSet, run the following command:
make undeploy
To install the leaderWorkerSet controller in a different namespace rather than lws-system
, you should first:
git clone https://github.com/kubernetes-sigs/lws.git
cd lws
Then change the kustomization.yaml namespace field as:
namespace: <your-namespace>
You should change the manager_auth_proxy_patch.yaml as well:
- name: manager
args:
- "--namespace=<your-namespace>"
Finally run:
IMAGE_REGISTRY=<registry>/<project> make image-push deploy
The webhooks use an internal certificate by default. However, if you wish to use cert-manager (which supports cert rotation), instead of internal cert, you can by performing the following steps.
First, install cert-manager on your cluster by running the following command:
VERSION=v1.11.0
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/$VERSION/cert-manager.yaml
Next, in the file lws/config/default/kustomization.yaml
replace ../internalcert
with
../certmanager
then uncomment all the lines beginning with [CERTMANAGER]
.
Finally, install the cert manager follwing the link: https://cert-manager.io/docs/installation/#default-static-install
and apply these configurations to your cluster with kubectl apply --server-side -k config/default
.