feat: Improve documentation and add example scripts
This commit is contained in:
1 parent
0c2596f6a6
commit
cb7dd981bf
8 files changed
+215
-34
No files matched your search
@@ -0,0 +1,51 @@
|
|||||||
|
# Create Docker Container
|
||||||
|
|
||||||
|
## Install Profile
|
||||||
|
|
||||||
|
Install the docker profile :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
lxc profile create docker
|
||||||
|
curl https://gitea.cloud.logerais.com/cloud.logerais.com/lxd-profiles/raw/branch/main/profiles/containerization/docker.profile.yaml | lxc profile edit docker
|
||||||
|
```
|
||||||
|
|
||||||
|
Or use the local profile:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./install.bash profiles/containerization/docker.profile.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
## Launch Container
|
||||||
|
|
||||||
|
Create and start a Docker container:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
lxc launch ubuntu:lts -p default -p docker docker-container
|
||||||
|
```
|
||||||
|
|
||||||
|
### Fix IP Address (Optional)
|
||||||
|
|
||||||
|
To assign a static IP address:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
lxc network attach lxdbr0 docker-container eth0 eth0
|
||||||
|
lxc config device set docker-container eth0 ipv4.address 10.0.1.10
|
||||||
|
```
|
||||||
|
|
||||||
|
## Use the Container
|
||||||
|
|
||||||
|
Access the container and verify Docker installation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Wait for cloud-init to complete
|
||||||
|
lxc exec docker-container -- cloud-init status --wait
|
||||||
|
|
||||||
|
# Access the container
|
||||||
|
lxc shell docker-container
|
||||||
|
|
||||||
|
# Inside the container - verify Docker is running
|
||||||
|
docker --version
|
||||||
|
docker run hello-world
|
||||||
|
```
|
||||||
|
|
||||||
|
Your Docker container is now ready for use with Docker already installed and configured.
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
# Create MicroK8s Container
|
||||||
|
|
||||||
|
## Install Profile
|
||||||
|
|
||||||
|
Install the microk8s profile :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
lxc profile create microk8s
|
||||||
|
curl https://gitea.cloud.logerais.com/cloud.logerais.com/lxd-profiles/raw/branch/main/profiles/containerization/microk8s.profile.yaml | lxc profile edit microk8s
|
||||||
|
```
|
||||||
|
|
||||||
|
Or use the local profile:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./install.bash profiles/containerization/microk8s.profile.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
## Launch Container
|
||||||
|
|
||||||
|
Import the base image and create the container:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Create and start the container
|
||||||
|
lxc launch ubuntu:lts -p default -p microk8s microk8s-container
|
||||||
|
```
|
||||||
|
|
||||||
|
### Fix IP Address (Optional)
|
||||||
|
|
||||||
|
To assign a static IP address:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
lxc network attach lxdbr0 microk8s-container eth0 eth0
|
||||||
|
lxc config device set microk8s-container eth0 ipv4.address 10.0.2.10
|
||||||
|
```
|
||||||
|
|
||||||
|
## Use the Container
|
||||||
|
|
||||||
|
Access the container and verify MicroK8s installation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Wait for cloud-init to complete
|
||||||
|
lxc exec microk8s-container -- cloud-init status --wait
|
||||||
|
|
||||||
|
# Access the container
|
||||||
|
lxc shell microk8s-container
|
||||||
|
|
||||||
|
# Inside the container - MicroK8s is already installed via the profile
|
||||||
|
microk8s status --wait-ready
|
||||||
|
microk8s kubectl get nodes
|
||||||
|
```
|
||||||
|
|
||||||
|
Your MicroK8s container is now ready for Kubernetes workloads. The profile handles the MicroK8s installation automatically.
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
# Create Traefik Container
|
||||||
|
|
||||||
|
## Install Profile
|
||||||
|
|
||||||
|
Install the traefik profile :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
lxc profile create traefik
|
||||||
|
curl https://gitea.cloud.logerais.com/cloud.logerais.com/lxd-profiles/raw/branch/main/profiles/applications/traefik.profile.yaml | lxc profile edit traefik
|
||||||
|
```
|
||||||
|
|
||||||
|
Or use the local profile:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./install.bash profiles/applications/traefik.profile.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
## Launch Container
|
||||||
|
|
||||||
|
Create the container with required profiles:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Create the container (without starting)
|
||||||
|
lxc init ubuntu:lts -p default -p traefik traefik-container
|
||||||
|
|
||||||
|
# Or with additional profiles for production use:
|
||||||
|
# lxc init ubuntu:lts -p default -p zfs -p net-front -p traefik -p traefik-volume-config traefik-container
|
||||||
|
```
|
||||||
|
|
||||||
|
### Fix IP Address (Optional)
|
||||||
|
|
||||||
|
To assign a static IP address:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
lxc network attach lxdbr0 traefik-container eth0 eth0
|
||||||
|
lxc config device set traefik-container eth0 ipv4.address 10.0.3.10
|
||||||
|
```
|
||||||
|
|
||||||
|
## Start and Use the Container
|
||||||
|
|
||||||
|
Start the container and verify the setup:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start the container
|
||||||
|
lxc start traefik-container
|
||||||
|
|
||||||
|
# Wait for cloud-init to complete
|
||||||
|
lxc exec traefik-container -- cloud-init status --wait
|
||||||
|
|
||||||
|
# Access the container
|
||||||
|
lxc shell traefik-container
|
||||||
|
|
||||||
|
# Inside the container - Traefik is configured via the profile
|
||||||
|
# Check if Traefik service is running
|
||||||
|
systemctl status traefik
|
||||||
|
```
|
||||||
|
|
||||||
|
Your Traefik container is now ready to serve as a reverse proxy. The profile handles the Traefik installation and basic configuration automatically.
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# See https://microk8s.io/docs/install-lxd
|
|
||||||
|
|
||||||
lxc profile create microk8s
|
|
||||||
curl https://raw.githubusercontent.com/ubuntu/microk8s/master/tests/lxc/microk8s.profile | lxc profile edit microk8s
|
|
||||||
|
|
||||||
# Import the baseimage
|
|
||||||
lxc image copy ubuntu:lts local: --auto-update --copy-aliases
|
|
||||||
|
|
||||||
# Create an instance
|
|
||||||
lxc launch -p default -p microk8s ubuntu:lts microk8s
|
|
||||||
|
|
||||||
# Fix the ip address
|
|
||||||
lxc network attach lxdbr0 microk8s eth0 eth0
|
|
||||||
lxc config device set microk8s eth0 ipv4.address 10.162.242.10
|
|
||||||
|
|
||||||
# Install microk8s inside the container
|
|
||||||
lxc exec microk8s -- sudo snap install microk8s --classic
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
## Create traefik instance
|
|
||||||
|
|
||||||
### Create container
|
|
||||||
lxc init ubuntu:lts -p default -p zfs -p front -p traefik -p letsencrypt traefik
|
|
||||||
|
|
||||||
### Fix ip address
|
|
||||||
lxc network attach front traefik eth0 eth0
|
|
||||||
lxc config device set traefik eth0 ipv4.address 10.112.16.10
|
|
||||||
|
|
||||||
### Start it
|
|
||||||
lxc start traefik
|
|
||||||
|
|
||||||
### Check it
|
|
||||||
lxc exec traefik -- cloud-init status --wait
|
|
||||||
lxc shell traefik
|
|
||||||
Executable
+18
@@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
CONTAINER_NAME="${1:-docker-container}"
|
||||||
|
|
||||||
|
echo "Creating Docker container: $CONTAINER_NAME"
|
||||||
|
|
||||||
|
# Install the profile using the helper script
|
||||||
|
./install.bash profiles/containerization/docker.profile.yaml
|
||||||
|
|
||||||
|
# Launch the container
|
||||||
|
lxc launch ubuntu:lts -p default -p docker "$CONTAINER_NAME"
|
||||||
|
|
||||||
|
# Wait for cloud-init
|
||||||
|
echo "Waiting for cloud-init to complete..."
|
||||||
|
lxc exec "$CONTAINER_NAME" -- cloud-init status --wait
|
||||||
|
|
||||||
|
echo "Docker container '$CONTAINER_NAME' is ready!"
|
||||||
|
echo "Access with: lxc shell $CONTAINER_NAME"
|
||||||
Executable
+18
@@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
CONTAINER_NAME="${1:-microk8s-container}"
|
||||||
|
|
||||||
|
echo "Creating microk8s container: $CONTAINER_NAME"
|
||||||
|
|
||||||
|
# Install the profile using the helper script
|
||||||
|
./install.bash profiles/containerization/microk8s.profile.yaml
|
||||||
|
|
||||||
|
# Launch the container
|
||||||
|
lxc launch ubuntu:lts -p default -p microk8s "$CONTAINER_NAME"
|
||||||
|
|
||||||
|
# Wait for cloud-init
|
||||||
|
echo "Waiting for cloud-init to complete..."
|
||||||
|
lxc exec "$CONTAINER_NAME" -- cloud-init status --wait
|
||||||
|
|
||||||
|
echo "microk8s container '$CONTAINER_NAME' is ready!"
|
||||||
|
echo "Access with: lxc shell $CONTAINER_NAME"
|
||||||
Executable
+18
@@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
CONTAINER_NAME="${1:-traefik-container}"
|
||||||
|
|
||||||
|
echo "Creating Traefik container: $CONTAINER_NAME"
|
||||||
|
|
||||||
|
# Install the profile using the helper script
|
||||||
|
./install.bash profiles/applications/traefik.profile.yaml
|
||||||
|
|
||||||
|
# Launch the container
|
||||||
|
lxc launch ubuntu:lts -p default -p traefik "$CONTAINER_NAME"
|
||||||
|
|
||||||
|
# Wait for cloud-init
|
||||||
|
echo "Waiting for cloud-init to complete..."
|
||||||
|
lxc exec "$CONTAINER_NAME" -- cloud-init status --wait
|
||||||
|
|
||||||
|
echo "Traefik container '$CONTAINER_NAME' is ready!"
|
||||||
|
echo "Access with: lxc shell $CONTAINER_NAME"
|
||||||
Reference in new issue
Block a user