Changes between Version 7 and Version 8 of minikubedeployment2023
- Timestamp:
- Dec 4, 2023, 5:08:08 AM (12 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
minikubedeployment2023
v7 v8 1 You may continue to install Kubernetes on the vm you already installed docker. If you are installing this on a different machine make sure docker is already installed.2 1 '''You may continue to install Kubernetes on the vm you already installed docker. If you are installing this on a different machine make sure docker is already installed. 2 ''' 3 3 ==== Part 1 ==== 4 4 5 Installing kubeadm, kubelet, and kubectl: 5 '''Installing kubeadm, kubelet, and kubectl:''' 6 6 7 7 1. Update the apt package index: … … 39 39 `kubeadm version` 40 40 41 Disable Swap Space 41 '''Disable Swap Space''' 42 42 43 43 8. Disable all swaps from /proc/swaps. … … 51 51 `free -h` 52 52 53 Install Container runtime 53 '''Install Container runtime''' 54 54 55 55 10. Configure persistent loading of modules … … 69 69 70 70 12. Ensure sysctl params are set 71 {{{ 72 71 72 {{{ 73 73 sudo tee /etc/sysctl.d/kubernetes.conf<<EOF 74 75 74 net.bridge.bridge-nf-call-ip6tables = 1 76 77 75 net.bridge.bridge-nf-call-iptables = 1 78 79 76 net.ipv4.ip_forward = 1 80 81 77 EOF 82 78 }}} … … 96 92 97 93 16. Configuring a cgroup driver 94 98 95 Both the container runtime and the kubelet have a property called "cgroup driver", which is essential for the management of cgroups on Linux machines. 99 96 … … 108 105 `systemctl status containerd` 109 106 110 Initialize control plane 107 '''Initialize control plane''' 108 111 109 18. Make sure that the br_netfilter module is loaded: 112 110 … … 114 112 115 113 Output should similar to: 114 116 115 {{{ 117 116 br_netfilter 22256 0 … … 133 132 You will see Your Kubernetes control-plane has initialized successfully! 134 133 134 You need to save the kubeadm join token string on a text document for future use. 135 135 136 22. To start the cluster, you need to run the following as a regular user (For this scenario we will only use a single host): 136 137 … … 157 158 158 159 `kubectl get nodes -o wide` 160 159 161 27. On a master/ control node to query the nodes you can use: 160 162 161 163 `kubectl get nodes` 162 164 163 Scheduling Pods on Kubernetes Master Node 164 28. By default, Kubernetes Cluster will not schedule pods on the master/control-plane node for security reasons. It is recommended you keep it this way, but for test environments you need to schedule Pods on 165 control-plane node to maximize resource usage. 166 167 `kubectl taint nodes --all node-role.kubernetes.io/control-plane-` 165 28. Connecting Worker nodes: 166 167 28.1. Install docker on both worker nodes as per the guidelines here.(LINK) 168 169 28.2. Install Kubernetes on each worker nodes. Follow steps 1 to 20. 170 171 28.3 Use previously saved kubeadm join token string to connect the workers. Run it with sudo. 172 173 If you forgot the token, run the following on your master to create a new token: 174 175 `kubeadm token create --print-join-command` 176 177 But remember, this will create a new token. 178 179 28.4 After all workers are connected, check status of the cluster: Here after all commands should be run on the master. 180 181 kubectl get nodes -o wide 168 182 169 183 ==== Part 2 ==== 170 184 Create a file simple-pod.yaml 185 171 186 {{{ 172 187 apiVersion: v1 … … 186 201 `kubectl apply -f simple-pod.yaml` 187 202 203 Check pod 204 205 `kubectl get pods` 206 207 Kill the Pod. 208 209 `kubectl delete pod nginx` 210 188 211 Pods are generally not created directly and are created using workload resources. See Working with Pods 189 Links to an external site. for more information on how Pods are used with workload resources212 [https://kubernetes.io/docs/concepts/workloads/pods/#working-with-pods Links to an external site]. for more information on how Pods are used with workload resources 190 213 191 214 ==== Part 3 ==== 192 215 193 Deploying a Simple Web Application on Kubernetes 216 '''Deploying a Simple Web Application on Kubernetes''' 217 194 218 1. Create a Deployment Manifest: 219 195 220 A Deployment ensures that a specified number of pod replicas are running at any given time. Let's create a simple Deployment for a web application using the nginx image. 196 221 Save the following YAML to a file named webapp-deployment.yaml: … … 221 246 222 247 2. Create a Service Manifest: 248 223 249 A Service is an abstraction that defines a logical set of Pods and enables external traffic exposure, load balancing, and service discovery. For our web application, we'll use a NodePort service. 250 224 251 Save the following YAML to a file named webapp-service.yaml: 225 252 … … 266 293 267 294 You should see the default nginx welcome page, indicating that your web application is running. 295 296 Delete all the deployments, run below command: 297 298 `kubectl delete deployment <deployment name>` 299 300 Delete all the Services, run below command: 301 302 `kubectl delete service <service name>` 268 303 269 304 Part 4 270 Deploying WordPress and MySQL on Kubernetes 305 306 '''Deploying WordPress and MySQL on Kubernetes''' 271 307 272 308 Installing dependancies: 309 273 310 Download rancher.io/local-path storage class: 274 311 … … 433 470 434 471 Part 5 472 435 473 Convert your Docker deployment into a Kubernetes deployment, you may compose your own service, deployment manifests as needed. Use the docker images you used previously when creating the pods/deployments. 436 474 437 Additional ref: https://kubebyexample.com/475 Additional ref:[ https://kubebyexample.com/]