combine-docker-kubernetes-and-windows-wsl

When running Windows 10 on your laptop, there are a couple of new options you can explore that simplify your life when it comes to Linux integration and also Docker and even Kubernetes.

This blog post is briefly covering the installation of the Windows WSL (Windows subsystem for Linux), the configuration of Docker to enable Kubernetes. Finally we make sure that Linux docker and kubernetes management commands are able to connect from the WSL Linux to the Windows Docker and Kubernetes.

Windows WSL (Windows Subsystem for Linux) installation

The WSL is really an amazing step to combine the best of Microsoft Windows and the best of Linux (Ubuntu in our example) with only a few limitations.

Please make sure to have the latest patch level of Windows 10 installed, so the WSL is no technical preview anymore.

To get the WSL feature enabled, just open an PowerShell console and run as Administrator and type:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

If asked, please restart your computer before continuing.

Search for Linux in the Windows Store and install your preferred linux distribution. We go for Ubuntu 18.04 in this blog post.

Windows WSL Windows Store

Restart your system again, when requested and you have Linux installed inside the Windows WSL.

Install Docker for Windows

Next application to be installed is Docker. Docker uses the Hyper-V functionality of Windows, so please be aware, that a hypervisor is installed on your system including new network devices like a virtual switch. 

IMPORTANT: That new virtual switch can mess your system up as sometimes the name resolution gets broken. 

If you run into that issue, that makes opening new websites unbelievable slow, you should consider the following workaround.

Windows change network adapter settings

Select change adapter options.

Microsoft Hyper-v vSwitch

Select vEthernet (Default Switch) and Properties

add DNS server to the vSwitch

add DNS server manually to your IP v4 and IP v6 settings.

IP v4 DNS examples:

Google DNS: 8.8.8.8

Quad9 DNS: 9.9.9.9

IP v6 DNS examples:

Google DNS: 2001:4860:4860::8888

Quad9 DNS: 2620:fe::fe, 2620:fe::9

Despite that nasty Hyper-V vSwitch issue Docker installation itself is extremely straightforward and you can find the download links and quickguide here: https://docs.docker.com/docker-for-windows/install/

Enable Kubernetes on Docker for Windows

Now you can get really excited because Kubernetes is part of the Docker for Windows installation in the meantime and only needs to be activated.

To do so, enter the Docker settings:

Docker Settings

and enable Kubernetes:

Kubernetes Docker for Windows

That’s it! The moment you see the little green icon at the bottom left, your Kubernetes is up and running and ready to manage your docker setup.

Install Docker inside the Windows WSL

Our goal is to control Docker and Kubernetes from within the Windows WSL, therefore we need to install the Docker and Kubernetes commands.

Lets start with Docker

sudo apt-get install apt-transport-https ca-certificates curl software-properties-commoncurl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"sudo apt-get update && sudo apt-get install docker-ce-cli

Now we need to combine the Linux installation with the Windows runtime:

echo "export DOCKER_HOST=tcp://localhost:2375" >> ~/.bashrc && source ~/.bashrc

As Docker likes to access the filesystem the same way, we also need to change the default WSL mountpoints for the Windows drive letters. Therefore we create a wsl.conf file that changes the mountpoints to c, d aso instead of /mnt/c aso.

Please create the file /etc/wsl.conf (sudo touch /etc/wsl.conf) and add the following content.

[automount]
root = /
options = "metadata"

We also need to configure Docker to expose the communication port on Port 2375:

Docker Port expose

To make sure all works, please restart your computer now.

Install Kubernetes Kubectl

The last step after the restart is the installation of the kubectl command. Open the Windows WSL (you can just type bash in the program search) and run the following commands:

curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add –
echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update && sudo apt-get install -y kubectl

Only one step left – linking the configs to the right location: Please make sure to change {Username} to your corresponding user homedirectory.

ln -s /c/Users/{Username}/.kube/config ~/.kube/config

Please test your new configured setup:

docker images

kubectl get all

Sometimes I realized after a reboot or sleep mode resume, that Kubernetes is not starting automatically. The easiest way to force a restart is to change the docker dns and click apply:

WSL Docker DNS

CNIL
Metrics and Logs

(formerly, Opvizor Performance Analyzer)

VMware vSphere & Cloud
PERFORMANCE MONITORING, LOG ANALYSIS, LICENSE COMPLIANCE!

Monitor and Analyze Performance and Log files:
Performance monitoring for your systems and applications with log analysis (tamperproof using immudb) and license compliance (RedHat, Oracle, SAP and more) in one virtual appliance!

Subscribe to Our Newsletter

Get the latest product updates, company news, and special offers delivered right to your inbox.

Subscribe to our newsletter

Use Case - Tamper-resistant Clinical Trials

Goal:

Blockchain PoCs were unsuccessful due to complexity and lack of developers.

Still the goal of data immutability as well as client verification is a crucial. Furthermore, the system needs to be easy to use and operate (allowing backup, maintenance windows aso.).

Implementation:

immudb is running in different datacenters across the globe. All clinical trial information is stored in immudb either as transactions or the pdf documents as a whole.

Having that single source of truth with versioned, timestamped, and cryptographically verifiable records, enables a whole new way of transparency and trust.

Use Case - Finance

Goal:

Store the source data, the decision and the rule base for financial support from governments timestamped, verifiable.

A very important functionality is the ability to compare the historic decision (based on the past rulebase) with the rulebase at a different date. Fully cryptographic verifiable Time Travel queries are required to be able to achieve that comparison.

Implementation:

While the source data, rulebase and the documented decision are stored in verifiable Blobs in immudb, the transaction is stored using the relational layer of immudb.

That allows the use of immudb’s time travel capabilities to retrieve verified historic data and recalculate with the most recent rulebase.

Use Case - eCommerce and NFT marketplace

Goal:

No matter if it’s an eCommerce platform or NFT marketplace, the goals are similar:

  • High amount of transactions (potentially millions a second)
  • Ability to read and write multiple records within one transaction
  • prevent overwrite or updates on transactions
  • comply with regulations (PCI, GDPR, …)


Implementation:

immudb is typically scaled out using Hyperscaler (i. e. AWS, Google Cloud, Microsoft Azure) distributed across the Globe. Auditors are also distributed to track the verification proof over time. Additionally, the shop or marketplace applications store immudb cryptographic state information. That high level of integrity and tamper-evidence while maintaining a very high transaction speed is key for companies to chose immudb.

Use Case - IoT Sensor Data

Goal:

IoT sensor data received by devices collecting environment data needs to be stored locally in a cryptographically verifiable manner until the data is transferred to a central datacenter. The data integrity needs to be verifiable at any given point in time and while in transit.

Implementation:

immudb runs embedded on the IoT device itself and is consistently audited by external probes. The data transfer to audit is minimal and works even with minimum bandwidth and unreliable connections.

Whenever the IoT devices are connected to a high bandwidth, the data transfer happens to a data center (large immudb deployment) and the source and destination date integrity is fully verified.

Use Case - DevOps Evidence

Goal:

CI/CD and application build logs need to be stored auditable and tamper-evident.
A very high Performance is required as the system should not slow down any build process.
Scalability is key as billions of artifacts are expected within the next years.
Next to a possibility of integrity validation, data needs to be retrievable by pipeline job id or digital asset checksum.

Implementation:

As part of the CI/CD audit functionality, data is stored within immudb using the Key/Value functionality. Key is either the CI/CD job id (i. e. Jenkins or GitLab) or the checksum of the resulting build or container image.

White Paper — Registration

We will also send you the research paper
via email.

CodeNotary — Webinar

White Paper — Registration

Please let us know where we can send the whitepaper on CodeNotary Trusted Software Supply Chain. 

Become a partner

Start Your Trial

Please enter contact information to receive an email with the virtual appliance download instructions.

Start Free Trial

Please enter contact information to receive an email with the free trial details.