Getty Images

Step-by-step guide: Get started with Weave for Kubernetes

Looking to streamline network management for Kubernetes clusters? Learn when and how to use CNI plugins, then walk through the steps of a Weave installation for Kubernetes.

Among the many Container Networking Interface plugins for Kubernetes, one of the most powerful is Weave Net, a Kubernetes networking tool from Weaveworks.

Explore why you might -- or might not -- choose Weave as your Kubernetes CNI plugin by learning about its benefits and main differences relative to other popular options. Then walk through the Weave setup process for a typical Kubernetes cluster.

What is Weave Net?

Weave Net, often simply called "Weave," is an open source CNI plugin that creates virtual networks for containers hosted within a Kubernetes cluster.

Weave provides the virtual networking infrastructure necessary for containers to talk to each other. It also supports service discovery, policy-based network control and data encryption.

Advantages of the Weave CNI plugin

If you're familiar with Kubernetes networking, you know that Weave Net is only one of many CNI plugins available today. Other popular options include Calico, Flannel and Cilium.

All CNI plugins do the same basic thing: They set up a virtual network based on the Container Network Interface standard, which Kubernetes uses by default to manage networking.

However, the Weave CNI plugin is notable because of the scope of its feature set. Weave does more than just meet the essential CNI requirements of providing virtual networking. It also provides several additional functionalities:

  • Service discovery. This helps containers identify each other on the network.
  • Load balancing. This distributes network load efficiently among containers.
  • Fault resilience. This minimizes network errors.
  • Multicast support. This lets users broadcast a single packet to multiple recipients in an efficient and simple way.
  • Network address translation (NAT) traversal. This more easily routes traffic between resources without public IP addresses.

Another of Weave's advantages over some competitor CNI plugins is its minimal resource overhead. This ensures Weave doesn't place a heavy burden on your clusters or leave significantly fewer resources available to your workloads.

Weave is also compatible with virtually every Kubernetes distribution and cluster deployment technique. Whether you deploy Kubernetes using a fully managed, cloud-based distribution like Amazon Elastic Kubernetes Service (EKS) or Google Kubernetes Engine (GKE); on self-managed cloud infrastructure; or on premises, you can use Weave as your networking plugin.

Weave vs. Calico, Flannel and other CNI plugins for Kubernetes

In terms of features, Weave is comparable to other major Kubernetes CNI plugins, such as Calico and Flannel. The latter provide most of the same functionalities as Weave and are similarly compatible with virtually any Kubernetes environment or distribution.

There are, however, some performance differences among Weave, Calico and Flannel. For example, one DevOps engineer's research found that Weave generally delivered the highest level of networking performance of all generic CNI plugins that he tested.

In the same tests, Weave also had the lowest CPU utilization, although its memory use was higher. The Amazon VPC CNI plugin performed better in some scenarios. But because it's designed only for use with AWS-based containers, it's not in the same category as the more flexible Weave, Calico and Flannel.

Weave's performance can vary depending on the specific nature of your setup. It's not accurate to say that Weave will always deliver better performance than Calico or Flannel or that its memory use will always be higher. If optimization is important to you, test different CNI plugin options within your environment to identify the best tool.

Table comparing the features, specs, pros and cons of the Calico, Flannel, Weave and Cilium CNI plugins for Kubernetes.
There are many options when it comes to Kubernetes CNI plugins, each of which has pros and cons depending on your use case.

How to set up a pod network with Weave

To set up Weave inside Kubernetes, run the following single kubectl command.

kubectl apply -f https://github.com/weaveworks/weave/releases/download/v2.8.1/weave-daemonset-k8s.yaml

At the time of publication, this command installs the most recent version of Weave. If you're installing Weave at a later date, you might want to check whether a newer version has been released.

The Weave setup requires additional steps if you use certain managed Kubernetes services, including EKS and GKE. You might have to tweak some permissions or networking settings to get Weave working under those Kubernetes distributions.

To confirm that Weave Net is running properly after installation, use the following kubectl command to check whether the Weave pods are operating.

kubectl get pods -n kube-system -l name=weave-net

The command should return a list of pods, with output similar to that shown below.

NAME            READY STATUS  RESTARTS AGE
weave-net-1jkl6  2/2  Running    0     1d
weave-net-bskbv  2/2  Running    0     1d
weave-net-m4x1b  2/2  Running    0     1d

If the command returns no output, Weave is not running. If something other than Running appears in the status column, you also have a problem. In that case, you can check the pod logs for more information using the following command.

kubectl logs -n kube-system [pod-name] weave

Once Weave is running in your cluster, you can interact with it by installing the Weave script on your nodes with these commands.

sudo curl -L git.io/weave -o /usr/local/bin/weave
sudo chmod a+x /usr/local/bin/weave

Then call the script with commands such as weave status.

Alternatively, you can interact with Weave using kubectl commands. This approach is more cumbersome, but it eliminates the need to install software on your hosts. Refer to the Weave documentation for details on how to manage Weave via kubectl.

Next Steps

Try out this GitOps tutorial with Flux and Kubernetes

Dig Deeper on Containers and virtualization

Software Quality
App Architecture
Cloud Computing
SearchAWS
TheServerSide.com
Data Center
Close