Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

mikeyGlitz
mikeyGlitz

Posted on • Edited on

     

Building The Cluster: Revised Edition

After putting in the work to
set up my cluster in Debian initially,
I came upon networking issues that I didn't know how to fix or why they were happening.
I ultimately ended up migrating my cluster toUbuntu.

The image that I'll be using for this guide is the
Ubuntu Server 20.04
image.

ℹ 20.04 is a Long-Term Support (LTS) release which means that
updates will and security fixes will be supported for the next
5 years.

As with before, I usedRufus to burn the image to a USB drive.

Installation was created with the following partition map

/dev/sda1    vg-ubuntu        lv-ubuntu-tmp  - /tmp - 2GB        lv-ubuntu-home - /home - 2GB        lv-ubuntu-root - / - Use all remaining space
Enter fullscreen modeExit fullscreen mode

Network Configuration

Network configuration in Ubuntu was quite different than with Debian.
Debian uses/etc/network/interfaces to configure network interfaces.
Ubuntu uses a utility callednetplan which manages network device configuration.
Ubuntu also includes the Intel WiFi divers as part of its distribution -- no need to
installfirmware-iwlwifi.

netplan uses YAML-based configuration for network configuration.
The configuration can be found at/etc/netplan/00-installer-config.yaml.
The configuration used for the gateway node is below.

network:ethernets:eth0:addresses:[172.16.0.1/24]nameservers:addresses:[172.16.0.1]version:2wifis:wlp2s0:access-points:"SSID":password:"wifi-password"addresses:[192.168.0.120/24]gateway4:192.168.0.1nameservers:addresses:[192.168.0.120]dhcp4:false
Enter fullscreen modeExit fullscreen mode

This configuration establishes 2 interfaces: wlp2s0 which will connect
to the external network (in this case, my home WiFi), and eth0 which
will connect to the cluster internal network.

The network configuration can be applied usingnetplan apply.

The compute node network configuration is similar

# This is the network config written by 'subiquity'network:ethernets:eth0:dhcp4:trueversion:2
Enter fullscreen modeExit fullscreen mode

This configuration uses the DHCP server which is set up on the gateway node
to receive an IP address lease.

DHCP

Fortunately, I'm still able to useisc-dhcp-server with Ubuntu.
I was able to follow the same instructions as before

NAT Routing

I learned some lessons with nat-routing from the previous cluster set up.

First setiptables to useiptables-legacy

update-alternatives--set iptables /usr/sbin/iptables-legacyupdate-alternatives--set ip6tables /usr/sbin/ip6tables-legacy
Enter fullscreen modeExit fullscreen mode

Enable ipv4 forwarding

echo1> /proc/sys/net/ipv4/ip_forwardsysctl net.ipv4.ip_forward=1
Enter fullscreen modeExit fullscreen mode

Set the NAT forwarding rules

# Enable masquerade on eth1 to rewrite the source address on outgoing packets. If you truly want symmetric NAT, you'll need the --random at the end:iptables-t nat-A POSTROUTING-o wlp2s0-j MASQUERADE--random# Allow traffic from internal to externaliptables-A FORWARD-i eth0-o wlp2s0-j ACCEPT# Allow returning traffic from external to internaliptables-A FORWARD-i wlp2s0-o eth0-m conntrack--ctstate RELATED, ESTABLISHED-j ACCEPT
Enter fullscreen modeExit fullscreen mode

Installiptables-persistent

apt-getinstalliptables-persistent
Enter fullscreen modeExit fullscreen mode

Save the IP rules

iptables-save> /etc/iptables/rules.v4
Enter fullscreen modeExit fullscreen mode

Cluster Setup

Setting up the cluster should be the
same procedure as before.

Network Share

The cluster has an external hard drive attached to it.
The external hard drive will have to be made available to the Kubernetes cluster as a network share.
The external hard drive can be exposed to the network by running a nfs server

Install the nfs server

sudoaptinstall-y nfs-kernel-server
Enter fullscreen modeExit fullscreen mode

Expose the external hard drive by updating/etc/exports

/mnt/external 172.16.0.0/29(rw,sync,no_subtree_check,no_root_squash)
Enter fullscreen modeExit fullscreen mode

Restart the NFS server and update the shares

sudoexportfs-avsudosystemctl restart nfs-kernel-server
Enter fullscreen modeExit fullscreen mode

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

  • Location
    Richmond, VA
  • Education
    BS Computer Science
  • Work
    Lead Software Engineer at Capital One Finance
  • Joined

More frommikeyGlitz

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp