You can Virtual Kubelet either on or external to a Kubernetes cluster using the virtual-kubelet
command-line tool. If you run Virtual Kubelet on a Kubernetes cluster, you can also deploy it using Helm.
For
virtual-kubelet
installation instructions, see the Setup guide.
External to a Kubernetes cluster
To run Virtual Kubelet external to a Kubernetes cluster (not on the Kubernetes cluster you are connecting it to), run the virtual-kubelet
binary with your chosen provider. Here’s an example:
virtual-kubelet --provider aws
Once Virtual Kubelet is deployed, run kubectl get nodes
and you should see a virtual-kubelet
node (unless you’ve named it something else using the --nodename
flag).
virtual-kubelet
The command-line tool for running Virtual Kubelets
Flags
Flag | Description | Default |
---|---|---|
--cluster-domain string | Kubernetes cluster domain | cluster.local |
--disable-taint bool | Disable the Virtual Kubelet Node taint | false |
--enable-node-lease bool | Use node leases (1.13) for node heartbeats | false |
--full-resync-period duration | How often to perform a full resync of Pods between Kubernetes and the provider | 1m0s |
--kubeconfig string | kubectl config file | $HOME/.kube/config |
--log-level string | The log level, e.g. trace debug , info , warn , or error | info |
--metrics-addr string | The address to listen on for metrics and stats | :10255 |
--namespace string | The Kubernetes namespace | all |
--nodename string | The Kubernetes Node name | virtual-kubelet |
--os string | The operating system (must be linux or windows ) | Linux |
--pod-sync-workers int | The number of Pod synchronization workers | 10 |
--provider string | The Virtual Kubelet provider | |
--provider-config string | The Virtual Kubelet provider configuration file | |
--startup-timeout duration | How long to wait for the virtual-kubelet to start | |
--trace-exporter strings | The tracing exporter to use. Available exporters are jaeger and ocagent | |
--trace-sample-rate string | The probability of tracing samples | |
--trace-service-name string | The name of the services used to register with the trace exporter | virtual-kubelet |
--trace-tag map | Tags to include with traces, in key=value form |
On a Kubernetes cluster
It’s possible to run the Virtual Kubelet as a Kubernetes Pod in a Minikube or Docker for Desktop Kubernetes cluster.
At this time, automation of this deployment is supported only for the
mock
provider.
In order to deploy the Virtual Kubelet, you need to install Skaffold, a Kubernetes development tool. You also need to make sure that your current kubectl context is either minikube
or docker-for-desktop
(depending on which Kubernetes platform you’re using).
First, clone the Virtual Kubelet repository:
git clone https://github.com/virtual-kubelet/virtual-kubelet
cd virtual-kubelet
Then:
make skaffold
By default, this will run Skaffold in development mode, which will make Skaffold watch hack/skaffold/virtual-kubelet/Dockerfile
and its dependencies for changes and re-deploy the Virtual Kubelet when changes happen. It will also make Skaffold stream logs from the Virtual Kubelet Pod.
Alternative, you can run Skaffold outside of development mode—if you aren’t concerned about continuous deployment and log streaming—by running:
make skaffold MODE=run
This will build and deploy the Virtual Kubelet and return.
Helm
You can use the Virtual Kubelet Helm chart to deploy Virtual Kubelet on Kubernetes.
First, add the Chart repository (the Chart is currently hosted on GitHub):
helm repo add virtual-kubelet \
https://raw.githubusercontent.com/virtual-kubelet/virtual-kubelet/master/charts
helm repo list
.Now you can install Virtual Kubelet using helm install
. Here’s an example command:
helm install virtual-kubelet/virtual-kubelet \
--name virtual-kubelet-azure \
--namespace virtual-kubelet \
--set provider=azure
This would install the Azure Container Instances Virtual Kubelet in the virtual-kubelet
namespace.
To verify that Virtual Kubelet has been installed, run this command, which will list the available nodes and watch for changes:
kubectl get nodes \
--namespace virtual-kubelet \
--watch