chore: improvements in docs

This commit is contained in:
ITQ
2025-08-20 13:53:21 +03:00
parent 4febd4f75a
commit 5bec757a16
9 changed files with 85 additions and 45 deletions
+27 -11
View File
@@ -12,6 +12,13 @@ Ensure you have the following installed on your system:
NOTE: You must have `libvirt` daemon running NOTE: You must have `libvirt` daemon running
### Generate SSH keypair
```bash
mkdir .ssh
ssh-keygen -f .ssh/id_rsa
```
### Goto Terraform directory ### Goto Terraform directory
```bash ```bash
@@ -24,17 +31,6 @@ cd terraform
cp .env.template .env cp .env.template .env
``` ```
### Add following records to hypervisor `/etc/hosts`
```bash
# ...
10.6.6.10 control-plane
2001:db8:ca2:2::10 control-plane
10.6.6.20 worker-1
2001:db8:ca2:2::20 worker-1
```
### Init Terraform ### Init Terraform
```bash ```bash
@@ -46,3 +42,23 @@ terraform init
```bash ```bash
terraform apply terraform apply
``` ```
## Provisioning Kubernetes
### Run provision script
```bash
./scripts/provision
```
## Testing dualstack
### Apply manifest.yaml (on node)
```bash
sudo kubectl apply -f manifest.yaml
```
### Check access via IPv{4,6}
You should access service via `10.6.6.10` and `2001:db8:ca2:2::10` inside cluster and on hypervisor.
+5
View File
@@ -1,2 +1,7 @@
10.6.6.1 _gateway
10.6.6.10 control-plane
2001:db8:ca2:2::10 control-plane 2001:db8:ca2:2::10 control-plane
10.6.6.20 worker-1
2001:db8:ca2:2::20 worker-1 2001:db8:ca2:2::20 worker-1
@@ -1,30 +1,7 @@
--- ---
# Old settings
# ipv4_stack: false
# ipv6_stack: true
# kube_network_plugin: calico
# kube_pods_subnet_ipv6: fd85:ee78:d8a6:8607::1:0000/112
# kube_service_addresses_ipv6: fd85:ee78:d8a6:8607::1000/116
# kube_network_node_prefix_ipv6: 119
# calico_ipv6pool_cidr: "{{ kube_pods_subnet_ipv6 }}"
# calico_pool_blocksize_ipv6: 116
# nat_outgoing_ipv6: true
# Settings for ipv6 only from Kubespray github tests
ipv4_stack: true ipv4_stack: true
ipv6_stack: true ipv6_stack: true
kube_network_plugin: calico kube_network_plugin: calico
etcd_deployment_type: kubeadm etcd_deployment_type: kubeadm
kube_proxy_mode: iptables kube_proxy_mode: iptables
enable_nodelocaldns: false
# Settings for dualstack from Kubespray github tests
# ipv4_stack: true
# ipv6_stack: true
View File
@@ -30,3 +30,8 @@ write_files:
append: true append: true
encoding: b64 encoding: b64
content: ${hosts_file} content: ${hosts_file}
- path: /home/ubuntu/manifest.yaml
owner: ubuntu:ubuntu
encoding: b64
defer: true
content: ${manifest_file}
@@ -30,3 +30,8 @@ write_files:
append: true append: true
encoding: b64 encoding: b64
content: ${hosts_file} content: ${hosts_file}
- path: /home/ubuntu/manifest.yaml
owner: ubuntu:ubuntu
encoding: b64
defer: true
content: ${manifest_file}
-7
View File
@@ -1,7 +0,0 @@
10.6.6.1 _gateway
10.6.6.10 control-plane
2001:db8:ca2:2::10 control-plane
10.6.6.20 worker-1
2001:db8:ca2:2::20 worker-1
+38
View File
@@ -0,0 +1,38 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-dualstack
spec:
replicas: 1
selector:
matchLabels:
app: nginx-dualstack
template:
metadata:
labels:
app: nginx-dualstack
spec:
containers:
- name: nginx
image: nginx:alpine
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: nginx-dualstack-svc
spec:
type: LoadBalancer
externalIPs:
- 10.6.6.10
- 2001:db8:ca2:2::10
selector:
app: nginx-dualstack
ports:
- port: 80
targetPort: 80
ipFamilyPolicy: PreferDualStack
ipFamilies:
- IPv4
- IPv6
+5 -4
View File
@@ -35,17 +35,18 @@ resource "libvirt_volume" "worker_images" {
data "template_file" "user_data" { data "template_file" "user_data" {
for_each = local.user_templates for_each = local.user_templates
template = file("${path.module}/configs/cloud-init/${each.value}") template = file("${path.root}/configs/cloud-init/${each.value}")
vars = { vars = {
hosts_file = base64encode(file("${path.module}/configs/hosts")) hosts_file = base64encode(file("${path.root}/../configs/hosts"))
ssh_public_key = file("../.ssh/id_rsa.pub") manifest_file = base64encode(file("${path.root}/configs/k8s/manifest.yaml"))
ssh_public_key = file("${path.root}/../.ssh/id_rsa.pub")
} }
} }
data "template_file" "network_config" { data "template_file" "network_config" {
for_each = local.user_templates for_each = local.user_templates
template = file("${path.module}/configs/cloud-init/network.yaml.tpl") template = file("${path.root}/configs/cloud-init/network.yaml.tpl")
vars = { vars = {
ipv4_address = local.node_addrs[each.key].ipv4 ipv4_address = local.node_addrs[each.key].ipv4
ipv4_prefix = local.ipv4_prefix ipv4_prefix = local.ipv4_prefix