Skip to content
Snippets Groups Projects
Commit 423ac475 authored by MUNIER Florian's avatar MUNIER Florian
Browse files

[add] test rancher

parent f2fa069c
No related branches found
No related tags found
No related merge requests found
resource "null_resource" "install_kubernetes" {
connection {
type = "ssh"
user = "ubuntu"
private_key = "${openstack_compute_keypair_v2.keypair_project.private_key}"
host = "${openstack_networking_floatingip_v2.floatip_admin.address}"
agent = "false"
}
# Install Kubernetes on the instance bastion
for_each = toset(var.INSTANCE_ORCHEST_NAME)
provisioner "remote-exec" {
inline = [
"curl -sfL https://get.k3s.io | sh -",
"sudo cat /var/lib/rancher/k3s/server/node-token > k3s_token",
"scp k3s_token -i .ssh/cluster_key.pem ubuntu@${openstack_compute_instance_v2.orchestration_instance[each.key].access_ip_v4}:k3s_token"]
}
depends_on = [openstack_compute_instance_v2.bastion_instance,
openstack_compute_instance_v2.orchestration_instance]
}
# Define the node token as an output
# # Join the worker nodes to the Kubernetes cluster
# resource "null_resource" "join_worker_nodes" {
# for_each = toset(var.INSTANCE_ORCHEST_NAME)
# # Connexion aux instances du cluster
# connection {
# type = "ssh"
# user = "ubuntu"
# bastion_private_key = "${openstack_compute_keypair_v2.keypair_project.private_key}"
# bastion_host = "${openstack_networking_floatingip_v2.floatip_admin.address}"
# private_key = "${openstack_compute_keypair_v2.keypair_cluster.private_key}"
# host = "${openstack_compute_instance_v2.orchestration_instance[each.key].access_ip_v4}"
# agent = "false"
# }
# provisioner "remote-exec" {
# inline = [
# "sudo curl -sfL https://get.k3s.io | K3S_URL=https://${openstack_networking_floatingip_v2.floatip_admin.address}:6443 K3S_TOKEN=${output.node_token} sh -"]
# }
# depends_on = [openstack_compute_instance_v2.bastion_instance,
# openstack_compute_instance_v2.orchestration_instance]
# }
# # Configure the Kubernetes network settings
# resource "kubernetes_network_policy" "default" {
# policy_types = ["Ingress", "Egress"]
# depends_on = [null_resource.install_kubernetes,
# null_resource.join_worker_nodes]
# }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment