Add new kubernetes role
This commit is contained in:
29
Vagrantfile
vendored
Normal file
29
Vagrantfile
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
NNODES=2
|
||||
|
||||
$script = <<-SCRIPT
|
||||
echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQClVS1uxDfwS6OusQ4qgcZ6hBc8YRBE8MyXu0sUfGN7S3itjI3W2ixD18v80el8dVQVR12jCY0ueavgoV1cHrfGWkFoLKi+QrA4MuSNUChj0NBbyLTmdwPvne8LRv3ttCbRSJ/6bIEveX8y/7kGn/R1NDFlfE6b5R8ersBUKCQM6YxblAkv/XH8cJlQXhr1nLhVOl/ae+Q/pTCbgioB8qrmGEuMvOLmavcFf7IJbJcSgeiXSOnyIRl2n64X6lbRK+MRZ61pF6vAOXA+Ixyt/fAbO7sjqU0+cEhU5Br5/VcqG4Bc5nhWimtXIHPry3aLV5PtN6K9/i3eA5F6Jpa82JzmUMEbWSBIga02yIw9GjRyAI6ccH/kJGuB6QN5/YwGHpOF2f0FGiEAbUz41mLngN3SsXL1pdV2hT3x56/GIcGe6p/f1cytwVCyOaE7W87B05w5JYb1sSFj6QuGW0rHWfnHT5SY87Mk/H8VgZPaPbm+hSjLIQRAmUYQR+Rub1o9bXE=" >> /home/vagrant/.ssh/authorized_keys
|
||||
SCRIPT
|
||||
|
||||
# All Vagrant configuration is done below. The "2" in Vagrant.configure
|
||||
# configures the configuration version (we support older styles for
|
||||
# backwards compatibility). Please don't change it unless you know what
|
||||
# you're doing.
|
||||
Vagrant.configure("2") do |config|
|
||||
(0..NNODES - 1).each do |i|
|
||||
config.vm.define "k8s-ubuntu-#{i}" do |node|
|
||||
#node.vm.box = "ubuntu/focal64"
|
||||
node.vm.box = "ubuntu/jammy64"
|
||||
node.vm.hostname = "k8s-ubuntu-#{i}"
|
||||
config.vm.provider "virtualbox" do |v|
|
||||
v.memory = 2048
|
||||
v.cpus = 2
|
||||
end
|
||||
node.vm.network "private_network", ip: "192.168.25.11#{i}"
|
||||
node.vm.provision "shell", inline: $script
|
||||
node.vm.provision "shell", inline: "echo hello from node #{i}"
|
||||
end
|
||||
end
|
||||
end
|
||||
12
group_vars/kubernetes.yml
Normal file
12
group_vars/kubernetes.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
|
||||
disable_firewall: true
|
||||
kubernetes_subnet: 192.168.25.0/24
|
||||
|
||||
# vip control plan 192.168.25.255
|
||||
setup_vip: false
|
||||
install_nginx_ingress: false
|
||||
install_longhorn: false
|
||||
|
||||
# This variable is used when the cluster is bootstrapped for the first time
|
||||
kubernetes_init_host: k8s-ubuntu-0
|
||||
31
hosts
31
hosts
@@ -1,6 +1,20 @@
|
||||
[perso]
|
||||
ovh_fr ansible_host=37.187.127.90 ansible_user=stephane
|
||||
scaleway_fr ansible_host=163.172.84.28 ansible_user=stephane
|
||||
# Test VM vagrant
|
||||
[kubernetes:children]
|
||||
kubemaster
|
||||
kubeworker
|
||||
|
||||
[kubemaster]
|
||||
k8s-ubuntu-0 ansible_host=192.168.25.110
|
||||
|
||||
[kubeworker]
|
||||
k8s-ubuntu-1 ansible_host=192.168.25.111
|
||||
|
||||
|
||||
|
||||
|
||||
; [perso]
|
||||
; ovh_fr ansible_host=37.187.127.90 ansible_user=stephane
|
||||
; scaleway_fr ansible_host=163.172.84.28 ansible_user=stephane
|
||||
|
||||
; # TO KNOW WHOIS CHISEL SERVER
|
||||
; [server]
|
||||
@@ -20,13 +34,4 @@ scaleway_fr ansible_host=163.172.84.28 ansible_user=stephane
|
||||
; ubuntu-worker ansible_host=192.168.33.11 ansible_user=vagrant ansible_password=vagrant
|
||||
|
||||
|
||||
#kubectl label node ubuntu-worker node-role.kubernetes.io/worker ubuntu-worker
|
||||
|
||||
|
||||
; curl -v -X POST \
|
||||
; -H "Content-Type: application/json" \
|
||||
; -d '{
|
||||
; "auth": "admin",
|
||||
; "password": "test"
|
||||
; }' \
|
||||
; https://semaphore.jingoh.fr/auth/login
|
||||
#kubectl label node ubuntu-worker node-role.kubernetes.io/worker ubuntu-worker
|
||||
27
kubernetes.yml
Normal file
27
kubernetes.yml
Normal file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
- name: Main playbook for Kubernetes cluster
|
||||
hosts: kubernetes
|
||||
become: true
|
||||
remote_user: vagrant
|
||||
|
||||
roles:
|
||||
- { role: ansible-role-linux-kubernetes }
|
||||
|
||||
|
||||
|
||||
# ---
|
||||
# - hosts: kubemaster
|
||||
# become: yes
|
||||
# remote_user: vagrant
|
||||
# roles:
|
||||
# - role: ansible-role-linux-kubernetes
|
||||
# vars_files:
|
||||
# - vars.yaml
|
||||
|
||||
# - hosts: kubeworker
|
||||
# become: yes
|
||||
# remote_user: vagrant
|
||||
# roles:
|
||||
# - role: ansible-role-linux-kubernetes
|
||||
# vars_files:
|
||||
# - vars.yaml
|
||||
1
roles/.gitignore
vendored
1
roles/.gitignore
vendored
@@ -10,6 +10,7 @@ geerlingguy.kubernetes/
|
||||
geerlingguy.pip/
|
||||
geerlingguy.containerd/
|
||||
tumf.systemd-service/
|
||||
ansible-role-linux-kubernetes/
|
||||
# SSH client side
|
||||
linux-system-roles.ssh/
|
||||
# SSH server side
|
||||
|
||||
@@ -6,7 +6,10 @@
|
||||
- src: GROG.sudo
|
||||
# DOCKER
|
||||
- src: geerlingguy.docker
|
||||
# CONTAINERD
|
||||
- src: geerlingguy.containerd
|
||||
# KUBERNETES
|
||||
- src: git+https://github.com/garutilorenzo/ansible-role-linux-kubernetes.git
|
||||
- src: geerlingguy.kubernetes
|
||||
# PIP
|
||||
- src: geerlingguy.pip
|
||||
|
||||
Reference in New Issue
Block a user