Skip to content

christian-tch/Boundary

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

HCP Boundary + Minikube — Lab

Lab de démonstration pour l'article : accès zero-trust à des ressources Kubernetes via HCP Boundary.

Architecture

HCP Boundary (controller managé)
        │
        │ worker registration
        ▼
Minikube
├── boundary-worker   (pod — proxy les sessions)
├── ssh-target        (pod — OpenSSH, ClusterIP uniquement)
└── mysql             (pod — MySQL 8.0, ClusterIP uniquement)

Prérequis

Déploiement

1. Démarrer Minikube

minikube start --cpus=4 --memory=4096 --driver=docker

2. Remplir les secrets

Édite les fichiers suivants et remplace les valeurs REPLACE_WITH_* :

k8s/ssh-target/deployment.yaml   # SSH user password
k8s/mysql/secret.yaml            # MySQL root + boundary passwords
k8s/worker/deployment.yaml       # HCP Boundary cluster ID + worker public addr

Pour l'adresse publique du worker, récupère l'IP Minikube :

minikube ip
# ex: 192.168.49.2 → public_addr = "192.168.49.2:30202"

3. Appliquer les manifests Kubernetes

kubectl apply -f k8s/namespace.yaml
kubectl apply -f k8s/worker/
kubectl apply -f k8s/ssh-target/
kubectl apply -f k8s/mysql/

Vérifie que les pods sont up :

kubectl get pods -n boundary

4. Enregistrer le worker dans HCP Boundary

Récupère le token d'activation généré par le worker :

kubectl logs -n boundary -l app=boundary-worker | grep "Worker Auth Registration Request"

Copie le token et enregistre le worker depuis l'UI HCP Boundary : Workers → New Worker → colle le token

5. Configurer Boundary avec Terraform

cd terraform/boundary-config
cp terraform.tfvars.example terraform.tfvars
# Édite terraform.tfvars avec tes valeurs
terraform init
terraform apply

Connexion aux cibles

SSH

# Récupère l'ID de la cible SSH depuis les outputs Terraform
export SSH_TARGET_ID=$(terraform -chdir=terraform/boundary-config output -raw ssh_target_id)

boundary authenticate \
  -addr=<BOUNDARY_CLUSTER_URL> \
  -auth-method-id=<AUTH_METHOD_ID>

boundary connect ssh \
  -target-id=$SSH_TARGET_ID

MySQL

export MYSQL_TARGET_ID=$(terraform -chdir=terraform/boundary-config output -raw mysql_target_id)

# Boundary ouvre un tunnel local et affiche les credentials brokered
boundary connect \
  -target-id=$MYSQL_TARGET_ID \
  -exec mysql -- \
    -u {{boundary.username}} \
    -p{{boundary.password}} \
    -h {{boundary.ip}} \
    -P {{boundary.port}} \
    demo

Nettoyage

terraform -chdir=terraform/boundary-config destroy
kubectl delete namespace boundary
minikube stop

About

github repository for my blog post regarding Hashicorp Boundary.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors