Created
November 17, 2021 19:41
-
-
Save farconada/91abdd5d09787f6c10ffea4c8a55091b to your computer and use it in GitHub Desktop.
K0s network problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: k0sctl.k0sproject.io/v1beta1 | |
kind: Cluster | |
metadata: | |
name: k0s-cluster | |
spec: | |
hosts: | |
- ssh: | |
address: 192.168.50.11 | |
user: vagrant | |
port: 22 | |
keyPath: /home/fernando/.vagrant.d/insecure_private_key | |
privateInterface: eth1 | |
role: controller | |
- ssh: | |
address: 192.168.50.12 | |
user: vagrant | |
port: 22 | |
keyPath: /home/fernando/.vagrant.d/insecure_private_key | |
privateInterface: eth1 | |
role: worker | |
- ssh: | |
address: 192.168.50.13 | |
user: vagrant | |
port: 22 | |
keyPath: /home/fernando/.vagrant.d/insecure_private_key | |
role: worker | |
privateInterface: eth1 | |
- ssh: | |
address: 192.168.50.14 | |
user: vagrant | |
port: 22 | |
keyPath: /home/fernando/.vagrant.d/insecure_private_key | |
role: worker | |
privateInterface: eth1 | |
- ssh: | |
address: 192.168.50.15 | |
user: vagrant | |
port: 22 | |
keyPath: /home/fernando/.vagrant.d/insecure_private_key | |
role: worker | |
privateInterface: eth1 | |
k0s: | |
version: 1.22.3+k0s.0 | |
config: | |
spec: | |
network: | |
podCIDR: 192.168.112.0/24 | |
serviceCIDR: 10.96.0.0/16 | |
provider: calico | |
extensions: | |
helm: | |
repositories: | |
- name: stable | |
url: https://charts.helm.sh/stable | |
- name: grafana | |
url: https://grafana.github.io/helm-charts | |
- name: ingress-nginx | |
url: https://kubernetes.github.io/ingress-nginx | |
- name: metallb | |
url: https://metallb.github.io/metallb | |
- name: argo | |
url: https://argoproj.github.io/argo-helm | |
- name: prometheus-community | |
url: https://prometheus-community.github.io/helm-charts | |
- name: longhorn | |
url: https://charts.longhorn.io | |
- name: nfs-subdir-external-provisioner | |
url: https://kubernetes-sigs.github.io/nfs-subdir-external-provisioner/ | |
- name: percona | |
url: https://percona.github.io/percona-helm-charts/ | |
charts: | |
- name: argo-cd | |
chartname: argo/argo-cd | |
namespace: argo-cd | |
- name: prometheus-stack | |
chartname: prometheus-community/prometheus | |
values: | | |
server: | |
nameOverride: prometheus | |
fullnameOverride: prometheus | |
persistentVolume: | |
enabled: false | |
alertmanager: | |
enabled: false | |
storageSpec: | |
emptyDir: | |
medium: Memory | |
namespace: logging | |
- name: grafana | |
chartname: grafana/grafana | |
namespace: logging | |
values: | | |
nameOverride: grafana | |
fullnameOverride: grafana | |
- name: loki | |
chartname: grafana/loki | |
namespace: logging | |
values: | | |
nameOverride: loki | |
fullnameOverride: loki | |
- name: promtail | |
chartname: grafana/promtail | |
namespace: logging | |
values: | | |
config: | |
lokiAddress: http://loki:3100/loki/api/v1/push | |
- name: ingress-nginx-prod | |
chartname: ingress-nginx/ingress-nginx | |
namespace: ingress-nginx-prod | |
values: | | |
controller: | |
metrics: | |
enabled: true | |
service: | |
annotations: | |
prometheus.io/port: "10254" | |
prometheus.io/scrape: "true" | |
ingressClassByName: true | |
ingressClassResource: | |
name: nginx-prod | |
enabled: true | |
controllerValue: k8s.io/ingress-nginx-prod | |
service: | |
annotations: | |
metallb.universe.tf/address-pool: ips-prod | |
- name: ingress-nginx-dev | |
chartname: ingress-nginx/ingress-nginx | |
namespace: ingress-nginx-dev | |
values: | | |
controller: | |
metrics: | |
enabled: true | |
service: | |
annotations: | |
prometheus.io/port: "10254" | |
prometheus.io/scrape: "true" | |
ingressClassByName: true | |
ingressClassResource: | |
name: nginx-dev | |
enabled: true | |
controllerValue: k8s.io/ingress-nginx-dev | |
service: | |
annotations: | |
metallb.universe.tf/address-pool: ips-dev | |
- name: metallb | |
chartname: metallb/metallb | |
namespace: metallb | |
values: | | |
configInline: | |
address-pools: | |
- name: ips-prod | |
protocol: layer2 | |
addresses: | |
- 192.168.50.100-192.168.50.110 | |
- name: ips-dev | |
protocol: layer2 | |
addresses: | |
- 192.168.50.111-192.168.50.120 | |
- name: longhorn | |
chartname: longhorn/longhorn | |
namespace: longhorn | |
- name: nfs-subdir-external-provisioner | |
chartname: nfs-subdir-external-provisioner/nfs-subdir-external-provisioner | |
namespace: nfs-subdir-external-provisioner | |
values: | | |
nfs: | |
server: 192.168.50.90 | |
path: /shared | |
- name: percona-operator | |
chartname: percona/pxc-operator | |
namespace: default | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IMAGE_NAME = "bento/ubuntu-20.04" | |
K8S_NAME = "k8scluster" | |
MASTERS_NUM = 1 | |
MASTERS_CPU = 2 | |
MASTERS_MEM = 2048 | |
NODES_NUM = 4 | |
NODES_CPU = 2 | |
NODES_MEM = 3072 | |
IP_BASE = "192.168.50." | |
VAGRANT_DISABLE_VBOXSYMLINKCREATE=1 | |
Vagrant.configure("2") do |config| | |
config.ssh.insert_key = false | |
(1..MASTERS_NUM).each do |i| | |
config.vm.define "k8s-m-#{i}" do |master| | |
master.vm.box = IMAGE_NAME | |
master.vm.network "private_network", ip: "#{IP_BASE}#{i + 10}" | |
master.vm.hostname = "k8s-m-#{i}" | |
master.vm.provider "virtualbox" do |v| | |
v.memory = MASTERS_MEM | |
v.cpus = MASTERS_CPU | |
end | |
master.vm.provision "ansible" do |ansible| | |
ansible.playbook = "site.yaml" | |
ansible.extra_vars = { | |
bind_vip_address: "192.168.50.200", | |
bind_interface: "eth1", | |
keepalived_check_ip: "any", | |
keepalived_check_port: 22, | |
keepalived_check_vid: 53, | |
keepalived_check_vmask: 24, | |
} | |
end | |
end | |
end | |
(1..NODES_NUM).each do |j| | |
config.vm.define "k8s-n-#{j}" do |node| | |
node.vm.box = IMAGE_NAME | |
node.vm.network "private_network", ip: "#{IP_BASE}#{j + 10 + MASTERS_NUM}" | |
node.vm.hostname = "k8s-n-#{j}" | |
node.vm.provider "virtualbox" do |v| | |
v.memory = NODES_MEM | |
v.cpus = NODES_CPU | |
end | |
node.vm.provision "ansible" do |ansible| | |
ansible.playbook = "site.yaml" | |
end | |
end | |
end | |
## NFS Server | |
config.vm.define "nfs-server" do |node| | |
node.vm.box = IMAGE_NAME | |
node.vm.network "private_network", ip: "192.168.50.90" | |
node.vm.hostname = "nfs-server" | |
node.vm.provider "virtualbox" do |v| | |
v.memory = NODES_MEM | |
v.cpus = NODES_CPU | |
end | |
node.vm.provision "ansible" do |ansible| | |
ansible.playbook = "site.yaml" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
just ignore provision section