Compare commits

...

9 Commits

Author SHA1 Message Date
Ganesh Maharaj Mahalingam 0e280f40fa cri-o update fixes
ClearLinux now has cri-o version 1.14.1 which allows multiple plugin
locations and also creates /opt/cni/bin by default. We no longer need
the hacks for them

Fixes: #82
Signed-off-by: Ganesh Maharaj Mahalingam <ganesh.mahalingam@intel.com>
2019-06-04 11:53:36 -07:00
Ganesh Maharaj Mahalingam d31d78c193 calico-node fails to come up cause of all.rp_filter
Currently net.ipv4.conf.all.rp_filter is set to 2 in Clear and
calico-node fails to come up unless that value is either 0 or 1.

Signed-off-by: Ganesh Maharaj Mahalingam <ganesh.mahalingam@intel.com>
2019-05-30 14:17:44 -07:00
Jose Carlos Venegas Munoz 04487a2cfe reset_stack: stop containerd and crio
- If stop CRI service if is running
- Restart the CRI service only if enabled
- Do not enable crio on reset_stack.sh this should be only part of the
setup.

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
2019-05-29 18:20:33 -07:00
Jose Carlos Venegas Munoz e67630b0bd create_stack: quote variables to avoid code expands
General fixes make my vim mark less warnings from shellcheck

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
2019-05-24 11:40:49 -07:00
Jose Carlos Venegas Munoz e08c92f6d5 stack: do not provide CRI socket
kubeadm autodetects the socket path based on defaults from well known
CRI servers.

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
2019-05-24 11:37:08 -07:00
Jose Carlos Venegas Munoz d00a5ea9d8 README: update flavor setup information.
Add docuementation to use ./clr-k8s-examples/reset_stack.sh help

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
2019-05-23 20:38:45 -07:00
Jose Carlos Venegas Munoz a9b3b5c506 create_stack: Add init and cni subcommands
Add more subcommands to to increase granularity

init: start cluster
cni: setup network

This functionality already existed, we only handle
subcommands in a more dynamic way.

Fixes: #92

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
2019-05-23 18:56:59 -07:00
Ganesh Maharaj Mahalingam 24f248b02f Set reverse path forwarding to strict.
Calico requires the default reverse path forwarding to be either 0 (no
validation) or 1 (strict validation). The default value of 2 (loose
validation) prevents calico from completing the setup and the pod is
always stuck getting ready.

Signed-off-by: Ganesh Maharaj Mahalingam <ganesh.mahalingam@intel.com>
2019-05-18 14:13:13 -07:00
Ganesh Maharaj Mahalingam d688cbb693 Download OVMF if it doesn't exist
Signed-off-by: Ganesh Maharaj Mahalingam <ganesh.mahalingam@intel.com>
2019-05-01 09:57:04 -07:00
6 changed files with 65 additions and 41 deletions
+4 -6
View File
@@ -50,14 +50,12 @@ master and also uses kubelet config via [`kubeadm.yaml`](kubeadm.yaml)
to propagate cluster wide kubelet configuration to all workers. Customize it if
you need to setup other cluster wide properties.
There are two flavors of install -
* `minimal`: initialize cluster, add kata runtimeclass, install canal CNI and metrics server
* `all`: minimal, install rook storage, prometheus, ELK, nginx-ingress, etc.,
There are different flavors to install, run `./create_stack.sh help` to get
more information.
```bash
# default is 'all'
./create_stack.sh [minimal|all]
# default shows help
./create_stack.sh <subcommand>
```
## Join Workers to the cluster
+6 -1
View File
@@ -13,7 +13,7 @@ $disks = 2
$disk_prefix = File.basename(File.dirname(__FILE__), "/")
$disk_size = "10G"
$box = "AntonioMeireles/ClearLinux"
$loader = File.join(File.dirname(__FILE__), "OVMF.fd")
File.exists?("/usr/share/qemu/OVMF.fd") ? $loader = "/usr/share/qemu/OVMF.fd" : $loader = File.join(File.dirname(__FILE__), "OVMF.fd")
$vm_name_prefix = "clr"
$base_ip = IPAddr.new("192.52.100.10")
$hosts = {}
@@ -21,6 +21,10 @@ $proxy_ip_list = ""
$driveletters = ('a'..'z').to_a
$setup_fc = true ? (['true', '1'].include? ENV['SETUP_FC'].to_s) : false
if not File.exists?($loader)
system('curl -O https://download.clearlinux.org/image/OVMF.fd')
end
# We need v 1.0.14 or above for this vagrantfile to work.
unless Vagrant.has_plugin?("vagrant-guests-clearlinux")
system "vagrant plugin install vagrant-guests-clearlinux"
@@ -61,6 +65,7 @@ Vagrant.configure("2") do |config|
c.vm.provider :libvirt do |lv|
lv.cpu_mode = "host-passthrough"
lv.nested = true
lv.loader = $loader
lv.cpus = $cpus
lv.memory = $memory
(1..$disks).each do |d|
+40 -24
View File
@@ -8,12 +8,23 @@ CUR_DIR=$(pwd)
SCRIPT_DIR="$(dirname "${BASH_SOURCE[0]}")"
function print_usage_exit() {
echo $"Usage: $0 [minimal|all]"
exit 1
exit_code=${1:-0}
cat <<EOT
Usage: $0 [subcommand]
Subcommands:
$(
for cmd in "${!command_handlers[@]}"; do
printf "\t%s:|\t%s\n" "${cmd}" "${command_help[${cmd}]:-Not-documented}"
done | sort | column -t -s "|"
)
EOT
exit "${exit_code}"
}
function finish() {
cd $CUR_DIR
cd "${CUR_DIR}"
}
trap finish EXIT
@@ -22,10 +33,10 @@ function cluster_init() {
#to enable the RuntimeClass featuregate
sudo -E kubeadm init --config=./kubeadm.yaml
rm -rf $HOME/.kube
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
rm -rf "${HOME}/.kube"
mkdir -p "${HOME}/.kube"
sudo cp -i /etc/kubernetes/admin.conf "${HOME}/.kube/config"
sudo chown "$(id -u):$(id -g)" "${HOME}/.kube/config"
# If this an interactive terminal then wait for user to join workers
if [ -t 0 ]; then
@@ -33,7 +44,7 @@ function cluster_init() {
fi
#Ensure single node k8s works
if [ $(kubectl get nodes | wc -l) -eq 2 ]; then
if [ "$(kubectl get nodes | wc -l)" -eq 2 ]; then
kubectl taint nodes --all node-role.kubernetes.io/master-
fi
}
@@ -109,20 +120,25 @@ function all() {
miscellaneous
}
cd $SCRIPT_DIR
if [[ "$#" -eq 0 ]]; then
all
exit
fi
declare -A command_handlers
command_handlers[init]=cluster_init
command_handlers[cni]=cni
command_handlers[minimal]=minimal
command_handlers[all]=all
command_handlers[help]=print_usage_exit
case "$1" in
minimal)
minimal
;;
all)
all
;;
*)
print_usage_exit
;;
esac
declare -A command_help
command_help[init]="Only inits a cluster using kubeadm"
command_help[cni]="Setup network for running cluster"
command_help[minimal]="init + cni + kata + metrics"
command_help[all]="minimal + storage + monitoring + miscellaneous"
command_help[help]="show this message"
cd "${SCRIPT_DIR}"
cmd_handler=${command_handlers[${1:-none}]:-unimplemented}
if [ "${cmd_handler}" != "unimplemented" ]; then
"${cmd_handler}"
else
print_usage_exit 1
fi
-2
View File
@@ -1,7 +1,5 @@
apiVersion: kubeadm.k8s.io/v1beta1
kind: InitConfiguration
nodeRegistration:
criSocket: /var/run/crio/crio.sock
---
apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
+13 -6
View File
@@ -3,7 +3,10 @@
set -o nounset
#Cleanup
sudo -E kubeadm reset -f --cri-socket="/var/run/crio/crio.sock"
reset_cluster() {
sudo -E kubeadm reset -f
}
reset_cluster
for ctr in $(sudo crictl ps --quiet); do
sudo crictl stop "$ctr"
@@ -15,9 +18,10 @@ for pod in $(sudo crictl pods --quiet); do
done
#Forcefull cleanup all artifacts
#This is needed is things really go wrong
#This is needed if things really go wrong
sudo systemctl stop kubelet
sudo systemctl stop crio
systemctl is-active crio && sudo systemctl stop crio
systemctl is-active containerd && sudo systemctl stop containerd
sudo pkill -9 qemu
sudo pkill -9 kata
sudo pkill -9 kube
@@ -39,8 +43,11 @@ sudo -E bash -c "rm -r /var/run/kata-containers/*"
sudo rm -rf /var/lib/rook
sudo systemctl daemon-reload
sudo systemctl enable kubelet crio
sudo systemctl restart crio
sudo systemctl is-active crio && sudo systemctl stop crio
sudo systemctl is-active containerd && sudo systemctl stop containerd
sudo systemctl is-enabled crio && sudo systemctl restart crio
sudo systemctl is-enabled containerd && sudo systemctl restart containerd
sudo systemctl restart kubelet
sudo -E kubeadm reset -f --cri-socket="/var/run/crio/crio.sock"
reset_cluster
+2 -2
View File
@@ -22,6 +22,8 @@ fi
sudo mkdir -p /etc/sysctl.d/
cat <<EOT | sudo bash -c "cat > /etc/sysctl.d/60-k8s.conf"
net.ipv4.ip_forward=1
net.ipv4.conf.default.rp_filter=1
net.ipv4.conf.all.rp_filter=1
EOT
sudo systemctl restart systemd-sysctl
@@ -50,8 +52,6 @@ sudo systemctl daemon-reload
echo "The following kubelet command may complain... it is not an error"
sudo systemctl enable --now kubelet crio || true
sudo mkdir -p /usr/libexec/cni /opt/cni
[ ! -e /opt/cni/bin/cni ] && sudo ln -s /usr/libexec/cni /opt/cni/bin
#Ensure that the system is ready without requiring a reboot
sudo swapoff -a
sudo systemctl restart systemd-modules-load.service