Lab de démonstration pour l'article : accès zero-trust à des ressources Kubernetes via HCP Boundary.
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)
- minikube
- kubectl
- terraform >= 1.5
- boundary CLI
- Un cluster HCP Boundary actif (version Essentials)
minikube start --cpus=4 --memory=4096 --driver=dockerÉ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 addrPour 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"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 boundaryRé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
cd terraform/boundary-config
cp terraform.tfvars.example terraform.tfvars
# Édite terraform.tfvars avec tes valeurs
terraform init
terraform apply# 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_IDexport 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}} \
demoterraform -chdir=terraform/boundary-config destroy
kubectl delete namespace boundary
minikube stop