Installing K3s on Alpine 3.20 Virtual Machine
In this article, we will walk through the steps to install K3s and Cilium on an Alpine 3.20 virtual machine. K3s is a lightweight Kubernetes distribution, and Cilium is a networking plugin that provides advanced security features. The following steps will guide you through the installation process.
Prerequisites
Before we begin, make sure you have the following:
- A virtual machine with Alpine 3.20 installed
- Internet access
Installing K3s
To install K3s, we need to run the following commands on the Alpine virtual machine:
curl -sfL https://get.k3s.io | sh -
This will install K3s on the virtual machine. Once the installation is complete, we can check the status of the K3s cluster by running:
sudo k3s kubectl get nodes
Installing Cilium
To install Cilium, we need to run the following commands:
curl -L https://github.com/cilium/cilium-cli/releases/download/v1.10.5/cilium-linux-amd64.tar.gz | tar xz
sudo mv cilium /usr/local/bin/
cilium install
This will install Cilium on the virtual machine. Once the installation is complete, we can check the status of Cilium by running:
sudo cilium status
Configuring Cilium
To configure Cilium, we need to create a Cilium network policy. Here is an example of a Cilium network policy that allows traffic between pods:
{
"apiVersion": "cilium.io/v2",
"kind": "CiliumNetworkPolicy",
"metadata": {
"name": "allow-all"
},
"spec": {
"description": "Allow all traffic between pods",
"endpointSelector": {
"matchLabels": {
"app": "default"
}
},
"ingress": [
{
"toPorts": [
{
"port": "0",
"protocol": "TCP"
}
],
"fromEndpoints": [
{
"matchLabels": {
"any": ["any"]
}
}
]
}
],
"egress": [
{
"toPorts": [
{
"port": "0",
"protocol": "TCP"
}
],
"toEndpoints": [
{
"matchLabels": {
"any": ["any"]
}
}
]
}
]
}
}
Save this policy as `allow-all.yaml` and apply it by running:
sudo cilium config replace --from-file allow-all.yaml
In this article, we have covered the steps to install K3s and Cilium on an Alpine 3.20 virtual machine. We have also covered the steps to configure Cilium by creating a network policy. With these steps, you should be able to run Kubernetes workloads securely on your Alpine virtual machine.