Rancher
unpublished draft
K3sRancher
Overall concept and fundamental
K3s Fundamental P1 - K3s Fundamental P2
K3s Installation: curl -sfL https://get.k3s.io | sh -
already install both master and agent on the machine.
Install single-node Rancher with Kubernetes#
- kubectl: a command-line tool, kubectl, allows you to run commands against Kubernetes clusters
- Helm: a package manager that helps you to find, share, and use software that is built for Kubernetes
- Install K3s and Nginx Ingress
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.1.1/deploy/static/provider/baremetal/deploy.yaml
: choose the latest stable baremetal versionkubectl get pods --all-namespaces
&kubectl get deploy ingress-nginx-controller -n ingress-nginx -o yaml
: Checking install- We have an ingress controller now. But, we do not have a load balancer. So we need to enable the ingress controller to use port 80 and 443 on the host.
kubectl patch deployment ingress-nginx-controller -n ingress-nginx --patch "$(cat ingress.yaml)"
curl localhost
: to test.- Expose a webpage to test:
kubectl create ns test
orapps
as tutorial. - Then add host name to host file
/etc/hosts
.
RKE#
- RKE is a fast, versatile Kubernetes installer that you can use to install Kubernetes on your Linux hosts. It seems like rke2 would take the spotlight soon so they have no intention to make rke script-installation convenience.
- Example of cluster.yml
ssh-keygen -t rsa -b 4096
: how much the size for ssh tunneling is optimal ?
kubectl Command#
kubectl Syntax:: kubectl [command] [TYPE] [NAME] [flags]
Command
: refers to want you want to perform (create, delete, etc.)Type
: refers to the resource type you are performing a command against (Pod, Service, etc.)Name
: the case-sensitive name of the object. If you don’t specify a name, it is possible to get information about all of the resources your command matches (Pods, for example)Flags
: these are optional but are useful when looking for specific resources. For example,--namespace
allows you to specify a particular namespace to perform an operation in.
Common commands#
- More frequently using commands
kubectl version --short
: Checking kuber versionkubectl config view
: View K3s configkubectl config get-contexts
: Get all K3s contextskubectl config current-context
: get current contextkubectl config use-context [context-name]
: Checkout to desired contextkubectl get cs
: get components statuskubectl cluster-info
kubectl get nodes -o wide
: get all nodes information (node here is node of cluster)kubectl get namespaces
: Overview of the namespaces available within a clusterkubectl get all --all-namespaces
: Overview of all of the resources running on your clusterkubectl get deploy ingress-nginx-controller -n ingress-nginx -o yaml
ingress-nginx-controller
: deploy nameingress-nginx
: namespaceyaml
: output type
Unclassified#
/etc/systemd/system/k3s.service
: change starting behavior. For Ex:ExecStart=/usr/local/bin/k3s server --disable traefik
- Manifest file API