Update Kubernetes
@@ -44,6 +44,19 @@ MetalLB hooks into your Kubernetes cluster, and provides a network load-balancer
 | 
				
			|||||||
kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.14.4/config/manifests/metallb-native.yaml
 | 
					kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.14.4/config/manifests/metallb-native.yaml
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Accessing the cluster from your machine
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Kubernetes config file can be found on any of the control plane nodes at:
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					/etc/rancher/k3s/k3s.yaml
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					You can copy that file over to your PC to
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					~/.kube/config
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					And edit the server url from 127.0.0.1 to the ip addres of one of the control plane nodes 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### MetalLB IP pool 
 | 
					### MetalLB IP pool 
 | 
				
			||||||
Create a new yaml file with the following content and be sure to customize your ip range:
 | 
					Create a new yaml file with the following content and be sure to customize your ip range:
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
@@ -211,3 +224,74 @@ then apply it:
 | 
				
			|||||||
```
 | 
					```
 | 
				
			||||||
kubectl apply -f file.yml
 | 
					kubectl apply -f file.yml
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Kubernetes Dashboard
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					I you want to be extra fancy you can deploy a web UI Dashboard for your kubernetes.
 | 
				
			||||||
 | 
					You need HELM for this one
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					helm repo add kubernetes-dashboard https://kubernetes.github.io/dashboard/
 | 
				
			||||||
 | 
					helm repo update 
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Fetch the default values file:
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					helm show values kubernetes-dashboard/kubernetes-dashboard > values.yaml
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Edit it and enable ingress:
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					  ingress:
 | 
				
			||||||
 | 
					    enabled: true 
 | 
				
			||||||
 | 
					    hosts:
 | 
				
			||||||
 | 
					      - dash..my.cluster.com
 | 
				
			||||||
 | 
					    ingressClassName: nginx
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					And install  it with the modified values file:
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					 helm upgrade --install kubernetes-dashboard kubernetes-dashboard/kubernetes-dashboard --create-namespace --namespace kubernetes-dashboard --values values.yaml
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Create service account for accesing the dashboard as admin
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Create a service account file
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					apiVersion: v1
 | 
				
			||||||
 | 
					kind: ServiceAccount
 | 
				
			||||||
 | 
					metadata:
 | 
				
			||||||
 | 
					  name: myusername
 | 
				
			||||||
 | 
					  namespace: kubernetes-dashboard
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					then apply it:
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					kubectl apply -f file.yml
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Then create a file to bind your user to the built in cluster-admin role
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					apiVersion: rbac.authorization.k8s.io/v1
 | 
				
			||||||
 | 
					kind: ClusterRoleBinding
 | 
				
			||||||
 | 
					metadata:
 | 
				
			||||||
 | 
					  name: myusername
 | 
				
			||||||
 | 
					roleRef:
 | 
				
			||||||
 | 
					  apiGroup: rbac.authorization.k8s.io
 | 
				
			||||||
 | 
					  kind: ClusterRole
 | 
				
			||||||
 | 
					  name: cluster-admin
 | 
				
			||||||
 | 
					subjects:
 | 
				
			||||||
 | 
					- kind: ServiceAccount
 | 
				
			||||||
 | 
					  name: myusername
 | 
				
			||||||
 | 
					  namespace: kubernetes-dashboard
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					then apply it:
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					kubectl apply -f file.yml
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					And finally, create a token you can use to login to the dashboard
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					kubectl -n kubernetes-dashboard create token myusername
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
		Reference in New Issue
	
	Block a user