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.2
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.2
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>
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
.
See lws/charts