Install K3S on CentOS8: Difference between revisions
Jump to navigation
Jump to search
| (4 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
=VM Setup= | =VM Setup= | ||
| Line 11: | Line 10: | ||
==Prepare OS== | ==Prepare OS== | ||
dnf -y upgrade | dnf -y upgrade | ||
dnf -y install setroubleshoot-server curl lsof wget | dnf -y install setroubleshoot-server curl lsof wget tar | ||
sed -i '/swap/d' /etc/fstab | sed -i '/swap/d' /etc/fstab | ||
| Line 21: | Line 20: | ||
reboot | reboot | ||
[[Category:K3S]] | |||
[[Category:OpenShift & K8S]] | |||
=Setup K3S= | =Setup K3S= | ||
| Line 37: | Line 38: | ||
* Create a CNAME | * Create a CNAME | ||
*.vm-name.domain.tld -> vm-name.domain.tld | *.vm-name.domain.tld -> vm-name.domain.tld | ||
=Helm Install= | |||
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | sh | |||
grep 'helm completion bash' $HOME/.bashrc || echo 'source <(helm completion bash)' >> $HOME/.bashrc | |||
grep KUBECONFIG $HOME/.bashrc || echo 'export KUBECONFIG=/etc/rancher/k3s/k3s.yaml' >> $HOME/.bashrc | |||
===.bash_profile=== | |||
* kubectl project/user prompt | |||
<pre> | |||
source <(kubectl completion bash) | |||
export PS1='### \D{%d.%m.%Y_%H:%M} \u@\e[1;32m\h\e[m:\w \e[1;33m✯ $(kubectl config view -o jsonpath="{.contexts[].context.namespace}")\e[m \n# ' | |||
</pre> | |||
* password gen | |||
<pre> | |||
genpasswd() { | |||
local l=$1 | |||
[ "$l" == "" ] && l=16 | |||
tr -dc A-Za-z0-9_=., < /dev/urandom | head -c ${l} | xargs | |||
} | |||
</pre> | |||
[[Category:K3S]] | [[Category:K3S]] | ||
[[Category:OpenShift & K8S]] | [[Category:OpenShift & K8S]] | ||
Latest revision as of 11:22, 6 May 2021
VM Setup
VM requirements
Just setup a CentOS8 minimal VM with the following requirements
- OS: centos8 minimal
- CPU: 2
- MEM: 8GB (6 GB may work as well)
- DISK: 40G (7GB used on a fresh setup)
Prepare OS
dnf -y upgrade dnf -y install setroubleshoot-server curl lsof wget tar
sed -i '/swap/d' /etc/fstab swapoff -a
firewall-cmd --permanent --zone=public --add-service=https firewall-cmd --zone=public --add-masquerade --permanent firewall-cmd --reload reboot
Setup K3S
curl -sfL https://get.k3s.io | sh
cat /etc/systemd/system/k3s.service systemctl status k3s
kubectl get nodes # all pods in running state? fine! kubectl get pods --all-namespaces
DNS for Wildcard Ingress
- Create a CNAME
*.vm-name.domain.tld -> vm-name.domain.tld
Helm Install
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | sh grep 'helm completion bash' $HOME/.bashrc || echo 'source <(helm completion bash)' >> $HOME/.bashrc
grep KUBECONFIG $HOME/.bashrc || echo 'export KUBECONFIG=/etc/rancher/k3s/k3s.yaml' >> $HOME/.bashrc
.bash_profile
- kubectl project/user prompt
source <(kubectl completion bash)
export PS1='### \D{%d.%m.%Y_%H:%M} \u@\e[1;32m\h\e[m:\w \e[1;33m✯ $(kubectl config view -o jsonpath="{.contexts[].context.namespace}")\e[m \n# '
- password gen
genpasswd() {
local l=$1
[ "$l" == "" ] && l=16
tr -dc A-Za-z0-9_=., < /dev/urandom | head -c ${l} | xargs
}