Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions chromebox/chromebox1/configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@
#./k8s_master.nix
#./k3s_master.nix
#./k3s_node.nix
# Modular Kubernetes configuration
./kubernetes.nix
./kubernetes_addonManager.nix
./kubernetes_etcd.nix
./kubernetes_networking.nix
./kubernetes_runtime.nix
];

# boot.loader.grub = {
Expand Down
133 changes: 126 additions & 7 deletions chromebox/chromebox1/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion chromebox/chromebox1/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@
# https://github.com/nix-community/disko/
disko.url = "github:nix-community/disko";
disko.inputs.nixpkgs.follows = "nixpkgs";
# https://gitlab.com/luxzeitlos/k8nix - Kubernetes addon management
k8nix.url = "gitlab:luxzeitlos/k8nix";
k8nix.inputs.nixpkgs.follows = "nixpkgs";
};

outputs = inputs@{ nixpkgs, disko, home-manager, ... }:
outputs = inputs@{ nixpkgs, disko, home-manager, k8nix, ... }:
let
system = "x86_64-linux";
pkgs = import nixpkgs {
Expand Down
107 changes: 107 additions & 0 deletions chromebox/chromebox1/helm-install-addons.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
#!/bin/bash
# Helmfile installation script for Cilium and Hubble
# This script installs Cilium and Hubble using Helmfile for declarative management

set -euo pipefail

# Configuration
CILIUM_VERSION="1.18.2"
NAMESPACE="kube-system"
HELMFILE_PATH="/home/das/nixos/chromebox/chromebox1/helmfile.yaml"

# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color

# Logging functions
log_info() {
echo -e "${GREEN}[INFO]${NC} $1"
}

log_warn() {
echo -e "${YELLOW}[WARN]${NC} $1"
}

log_error() {
echo -e "${RED}[ERROR]${NC} $1"
}

# Check if kubectl is available and cluster is accessible
check_kubectl() {
if ! command -v kubectl &> /dev/null; then
log_error "kubectl is not installed or not in PATH"
exit 1
fi

if ! kubectl cluster-info &> /dev/null; then
log_error "Cannot connect to Kubernetes cluster"
exit 1
fi

log_info "Kubernetes cluster is accessible"
}

# Check if Helm and Helmfile are available
check_helm() {
if ! command -v helm &> /dev/null; then
log_error "Helm is not installed or not in PATH"
exit 1
fi

if ! command -v helmfile &> /dev/null; then
log_error "Helmfile is not installed or not in PATH"
exit 1
fi

log_info "Helm is available: $(helm version --short)"
log_info "Helmfile is available: $(helmfile version)"
}

# Install Cilium and Hubble using Helmfile
install_with_helmfile() {
log_info "Installing Cilium and Hubble using Helmfile..."

if [ ! -f "${HELMFILE_PATH}" ]; then
log_error "Helmfile configuration not found at ${HELMFILE_PATH}"
exit 1
fi

# Update repositories
log_info "Updating Helm repositories..."
helmfile -f "${HELMFILE_PATH}" repos

# Apply the Helmfile configuration
log_info "Applying Helmfile configuration..."
helmfile -f "${HELMFILE_PATH}" apply

log_info "Cilium and Hubble installation completed via Helmfile"
}

# Wait for Cilium to be ready
wait_for_cilium() {
log_info "Waiting for Cilium to be ready..."
kubectl wait --for=condition=ready pod -l k8s-app=cilium -n ${NAMESPACE} --timeout=300s
log_info "Cilium is ready"
}

# Main installation function
main() {
log_info "Starting Cilium and Hubble installation via Helmfile"

check_kubectl
check_helm
install_with_helmfile
wait_for_cilium

log_info "Cilium and Hubble installation completed successfully!"
log_info "You can now use:"
log_info " - kubectl get pods -n ${NAMESPACE} # Check Cilium pods"
log_info " - cilium status # Check Cilium status"
log_info " - kubectl port-forward -n ${NAMESPACE} svc/hubble-ui 12000:80 # Access Hubble UI"
log_info " - helmfile -f ${HELMFILE_PATH} status # Check Helmfile status"
}

# Run main function
main "$@"
20 changes: 20 additions & 0 deletions chromebox/chromebox1/helmfile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
repositories:
- name: cilium
url: https://helm.cilium.io/

releases:
- name: cilium
namespace: kube-system
chart: cilium/cilium
version: 1.18.2
values:
- hubble:
relay:
enabled: true
ui:
enabled: true
- ipam:
mode: kubernetes
- kubeProxyReplacement: strict
- k8sServiceHost: "172.16.40.178" # Will be updated per node
- k8sServicePort: 6443
Loading