-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimple-talos-launch.sh
More file actions
executable file
·75 lines (66 loc) · 2.19 KB
/
simple-talos-launch.sh
File metadata and controls
executable file
·75 lines (66 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/env bash
# simple-talos-launch.sh - Generate config with known IP, launch once
set -euo pipefail
REGION="eu-west-1"
SECURITY_GROUP="sg-0e6b4a78092854897"
SUBNET_ID="subnet-07a140ab2b20bf89b"
TALOS_AMI="ami-07898be81f2028262"
# Configuration - we know these addresses ahead of time
IPV4_ADDRESS="10.10.1.119"
CLUSTER_ENDPOINT="https://${IPV4_ADDRESS}:6443"
echo "🚀 Generating Talos config with known endpoint: $CLUSTER_ENDPOINT"
# Clean up and generate config once with correct endpoint
rm -f controlplane.yaml worker.yaml talosconfig
talosctl gen config talos-cozystack-cluster $CLUSTER_ENDPOINT \
--with-examples=false \
--with-docs=false \
--with-kubespan \
--install-disk /dev/xvda \
--config-patch '@time-server-patch.yaml'
echo "📝 Launching instance with correct config..."
INSTANCE_ID=$(aws ec2 run-instances \
--region $REGION \
--image-id $TALOS_AMI \
--instance-type c7g.large \
--security-group-ids $SECURITY_GROUP \
--subnet-id $SUBNET_ID \
--private-ip-address $IPV4_ADDRESS \
--ipv6-address-count 1 \
--user-data file://controlplane.yaml \
--block-device-mappings '[
{
"DeviceName": "/dev/xvda",
"Ebs": {
"VolumeSize": 20,
"VolumeType": "gp3",
"DeleteOnTermination": true
}
}
]' \
--tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=talos-simple}]' \
--query 'Instances[0].InstanceId' \
--output text)
echo "✅ Created instance: $INSTANCE_ID at $IPV4_ADDRESS"
echo ""
echo "📋 Copy files to bastion and bootstrap:"
echo " scp talosconfig controlplane.yaml worker.yaml user@bastion:~/"
echo ""
echo "🤖 On bastion (wait ~3 min for Talos API):"
echo " export TALOSCONFIG=\$(pwd)/talosconfig"
echo " talosctl config endpoint $IPV4_ADDRESS"
echo " talosctl config nodes $IPV4_ADDRESS"
echo ""
echo " # Test connection"
echo " talosctl health --server=false"
echo ""
echo " # Bootstrap cluster"
echo " talosctl bootstrap"
echo " talosctl health"
echo ""
echo " # Get kubeconfig and test"
echo " talosctl kubeconfig ."
echo " export KUBECONFIG=\$(pwd)/kubeconfig"
echo " kubectl get nodes"
echo ""
echo "🌐 Instance: $INSTANCE_ID"
echo "📍 Endpoint: $CLUSTER_ENDPOINT"