Kubernetes tutorial: How to install a cluster on Ubuntu with kubeadm?

Поделиться
HTML-код
  • Опубликовано: 13 янв 2025
  • ► Telegram Group: t.me/devops_talks_en
    Start learning Kubernetes with my useful tutorial on installing a cluster on Ubuntu with kubeadm. In this step-by-step guide, I'll walk you through the process of setting up a Kubernetes cluster on Ubuntu, leveraging the simplicity and efficiency of kubeadm. Whether you're a beginner eager to dive into container orchestration or an experienced user looking to expand your skills, this tutorial provides clear instructions and practical demonstrations to help you get your Kubernetes cluster up.
    Discover the ease of deploying a Kubernetes cluster on Ubuntu with kubeadm in my in-depth video tutorial. From installing the necessary dependencies to initializing the cluster and joining nodes, I cover every aspect of the setup process. Don't miss out on this opportunity to level up your Kubernetes expertise!

Комментарии • 77

  • @AjayAnand21
    @AjayAnand21 3 месяца назад +2

    Thanks for step by step instructions. I was able to setup K8s cluster without any issue

  • @osamaabou-el-gibeen9704
    @osamaabou-el-gibeen9704 7 месяцев назад +4

    man that cgroup driver saved my week. thanks a million

  • @ManjunathKundargi
    @ManjunathKundargi 8 месяцев назад +1

    Hi, what will be the command at 3:55 if i am using docker instead of containerd

    • @LearnDevOpswithSerge
      @LearnDevOpswithSerge  8 месяцев назад

      Hi, Kubernetes has not supported Docker since version 1.24. Here is more information about it: kubernetes.io/blog/2022/02/17/dockershim-faq/

  • @mananchandna8898
    @mananchandna8898 17 дней назад +1

    why my flannel is stuck on crashloopbackoff and can you please make a video of setting up federation between aws eks and on premesis clusters

    • @LearnDevOpswithSerge
      @LearnDevOpswithSerge  17 дней назад +1

      Hi,
      1. Check the events and logs.
      2. I'll consider creating a video on connecting multiple clusters.

  • @badex3301
    @badex3301 8 месяцев назад +1

    Thanks for the informative vid. Would be nice to have a google doc stating the command at 3:55

    • @LearnDevOpswithSerge
      @LearnDevOpswithSerge  8 месяцев назад +5

      Hi,
      containerd config default | sed 's/SystemdCgroup = false/SystemdCgroup = true/' | sed 's/sandbox_image = "registry.k8s.io\/pause:3.6"/sandbox_image = "registry.k8s.io\/pause:3.9"/' | sudo tee /etc/containerd/config.toml

    • @badex3301
      @badex3301 8 месяцев назад +2

      @@LearnDevOpswithSerge thank you! Subscribed

  • @sarvamsahitya
    @sarvamsahitya 6 месяцев назад

    Thanks. Did try to install the dashboard. Please share if you have done it already

    • @LearnDevOpswithSerge
      @LearnDevOpswithSerge  5 месяцев назад

      Hi, here it is: ruclips.net/video/SUk_Nm5BiPw/видео.html

  • @ashanp1234
    @ashanp1234 7 месяцев назад +1

    Thank you very much for this video. Can you share the manifest file you created in 9:09 ?

    • @LearnDevOpswithSerge
      @LearnDevOpswithSerge  7 месяцев назад +2

      Hi, here it is:
      apiVersion: apps/v1
      kind: Deployment
      metadata:
      name: nginx-deployment
      labels:
      app: nginx
      spec:
      replicas: 3
      selector:
      matchLabels:
      app: nginx
      template:
      metadata:
      labels:
      app: nginx
      spec:
      containers:
      - name: nginx
      image: nginx:1.14.2
      ports:
      - containerPort: 80
      ---
      apiVersion: v1
      kind: Service
      metadata:
      name: nginx
      spec:
      type: ClusterIP
      ports:
      - targetPort: 80
      port: 80
      selector:
      app: nginx

  • @filippogiorgi110
    @filippogiorgi110 17 дней назад

    Hi Serge, I followed your tutorial for create my cluster and I started a pod in which there is a C server I created. But I can't communicate from the node because the connection drops. I tried both with a client I created and with the curl and telnet commands but I still get an error: "Connection close by peer". Do you know what the problem could be?

    • @LearnDevOpswithSerge
      @LearnDevOpswithSerge  17 дней назад

      Hi, try to deploy another simple app. For example, install the Nginx Web server and check the connection.
      I guess the problem can be in your C server.

    • @filippogiorgi110
      @filippogiorgi110 17 дней назад

      @ Hi, I don’t think so because the server out the pod, works correctly

    • @LearnDevOpswithSerge
      @LearnDevOpswithSerge  17 дней назад

      @filippogiorgi110 "Connection close by peer" means it was closed by the server side. That's why I suggested deploying another app.

  • @srinivasaraju8399
    @srinivasaraju8399 3 дня назад

    Can I install using only Ubuntu Application without any cloud provider like AKS, EKS?

    • @LearnDevOpswithSerge
      @LearnDevOpswithSerge  3 дня назад +1

      Hi, this guide explains how to install an on-premises cluster on Ubuntu.

  • @joshuaedward6893
    @joshuaedward6893 2 месяца назад

    Hi there, i cant seem to get my network working at all, I'm using the same manifest as you(edited the necessary things) but its not working, my kube-flannel is currently stuck at terminating phase for more than a day now.

  • @ramonriserio
    @ramonriserio Месяц назад

    man,
    Despite I've defined apiserver-advertise-address flag in kubeadm init command:
    kubeadm init apiserver-advertise-address=192.168.10.17
    the IP of kube-apiserver-master and etcd-master is 10.0.2.15 (NAT interface) and I think this is causing CrashLoopBackOff when intalling Flannel.
    Do you know how I can fix it?

    • @LearnDevOpswithSerge
      @LearnDevOpswithSerge  Месяц назад

      Hi,
      1. You can check your Kubernetes API server IP address using the command: "kubectl -n kube-system get pod -l component=kube-apiserver -o yaml | grep advert" or find it in the file "/etc/kubernetes/manifests/kube-apiserver.yaml" on the master node
      2. Recheck your internal IP addresses (5:55) of the nodes using the command "kubectl get node -o wide".
      They shouldn't be 10.0.2.15.
      3. Recheck the interface in the flannel config (8:19)

  • @laurentsun4707
    @laurentsun4707 6 месяцев назад

    Hello, for the command at 5:35 how to you find the --apiserver-advertise-address

    • @LearnDevOpswithSerge
      @LearnDevOpswithSerge  6 месяцев назад +1

      Hi, it is an IP of your master node. You can find out it by the command: "ip address show" or shortly "ip a".
      ```
      vagrant@master:~$ ip address show | grep 192.168.1.50
      inet 192.168.1.50/24 brd 192.168.1.255 scope global enp0s8
      ```

    • @laurentsun4707
      @laurentsun4707 6 месяцев назад

      @@LearnDevOpswithSerge Thank you! Do you have a video to show how to setup the kubernetes dashboard?

    • @LearnDevOpswithSerge
      @LearnDevOpswithSerge  6 месяцев назад +1

      I haven't done it yet. Thanks for the idea!

    • @ElliotAlderson-s4l
      @ElliotAlderson-s4l 5 месяцев назад

      @@LearnDevOpswithSerge also, the --pod-network-cidr, where did you find that?

    • @LearnDevOpswithSerge
      @LearnDevOpswithSerge  5 месяцев назад

      @@ElliotAlderson-s4l Hi, 2d item kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/#initializing-your-control-plane-node

  • @youtea7324
    @youtea7324 6 месяцев назад

    at 03:47 you prepared a command, from where do i get it.

    • @LearnDevOpswithSerge
      @LearnDevOpswithSerge  6 месяцев назад

      Hi,
      containerd config default | sed 's/SystemdCgroup = false/SystemdCgroup = true/' | sed 's/sandbox_image = "registry.k8s.io\/pause:3.6"/sandbox_image = "registry.k8s.io\/pause:3.9"/' | sudo tee /etc/containerd/config.toml

    • @christopherobinna2140
      @christopherobinna2140 5 месяцев назад

      @@LearnDevOpswithSerge how did you generate this command. any documentation for it. up till this stage you have explained everything in detail but just copied and pasted this out of nowhere. the tutorial is very great!

    • @LearnDevOpswithSerge
      @LearnDevOpswithSerge  5 месяцев назад

      ​ @christopherobinna2140 Hi,
      1. SystemdCgroup = true # The documentaion about it kubernetes.io/docs/setup/production-environment/container-runtimes/#containerd-systemd
      2. The issue with sandbox image: github.com/cri-o/cri-o/issues/6985
      discuss.kubernetes.io/t/can-not-install-kubernetes-cluster-with-kubeadm/24079
      ----
      Note that the version of the sandbox image in each Containerd version can be changed so check it. For example, in my video, the version is 3.6 and now it is 3.8.
      The message while installing Kubernetes:
      W0725 06:32:35.829024 14158 checks.go:844] detected that the sandbox image "registry.k8s.io/pause:3.8" of the container runtime is inconsistent with that used by kubeadm.It is recommended to use "registry.k8s.io/pause:3.9" as the CRI sandbox image.

  • @richardsrobin_r
    @richardsrobin_r 4 месяца назад

    vagrant file for networking setting , which ip should be used for --apiserver-advertise-address =windows ip4 address ?

    • @LearnDevOpswithSerge
      @LearnDevOpswithSerge  4 месяца назад

      Hi, here is my config:
      Vagrant file:
      3.times do |i|
      config.vm.define "node#{i+1}" do |node|
      node.vm.hostname = "node#{i+1}"
      node.vm.network "public_network", bridge: "Intel(R) Wireless-AC 9560 160MHz", ip: "192.168.1.5#{i+1}"
      end
      end
      --apiserver-advertise-address:
      root@node1:~# cat /etc/kubernetes/manifests/kube-apiserver.yaml | grep advertise
      kubeadm.kubernetes.io/kube-apiserver.advertise-address.endpoint: 192.168.1.51:6443
      - --advertise-address=192.168.1.51

  • @mazahirahmed
    @mazahirahmed 3 месяца назад

    8.20 name of internal network interface is not same for master and slave for me, I am getting error.

    • @LearnDevOpswithSerge
      @LearnDevOpswithSerge  3 месяца назад

      Hi,
      1. You can set labels on each node group with different interface names. For example,
      node1 - label1
      node2 - label1
      node3 - label2
      node4 - label2
      2. Make 2 DaemonSets with different args for containers and set different nodeSelectors for each DaemonSet.
      3. I suggest you watch my video: ruclips.net/video/A9phy8irRXY/видео.html

  • @RaviKumar-ko2hn
    @RaviKumar-ko2hn 3 месяца назад

    Hi
    I am trying to setup k8s Ubuntu 22 jammy using aws ec2 instance. But issue with pod network. In logs i got dockershim.sock no such file directly like.
    How do i fix this issue.

    • @LearnDevOpswithSerge
      @LearnDevOpswithSerge  3 месяца назад

      Hi,
      The best choice is not to use Dockershim.
      Dockershim has been removed as of Kubernetes v1.24.
      kubernetes.io/blog/2022/05/03/dockershim-historical-context/

  • @hamzaerrahma9858
    @hamzaerrahma9858 5 месяцев назад

    Thank you for this video, I initialized my cluster and everything was working perfectly. However, after I rebooted my machines, the kubectl get nodes command stopped working. When I run sudo kubectl get nodes, I get the following error message:The connection to the server 192.168.56.101:6443 was refused - did you specify the right host or port?

    • @LearnDevOpswithSerge
      @LearnDevOpswithSerge  5 месяцев назад

      Hi, have you disabled swap?
      stackoverflow.com/questions/56737867/the-connection-to-the-server-x-x-x-6443-was-refused-did-you-specify-the-right
      Try to execute these commands on the master node:
      1. sudo -i
      2. swapoff -a

    • @hamzaerrahma9858
      @hamzaerrahma9858 5 месяцев назад

      @@LearnDevOpswithSerge Thanks You Very Much

  • @satishbarnana2267
    @satishbarnana2267 5 месяцев назад

    how can we configure 3 vms in single machine and can we run master and worker nodes on same machine?

    • @LearnDevOpswithSerge
      @LearnDevOpswithSerge  5 месяцев назад

      Hi,
      I use VirtualBox with Vagrant to create VMs. In Linux, you can use KVM or VirtualBox too.
      Yes, you can use master for your workloads. To do it, remove taints on the master/control plane node.

  • @PratapKumar-sm9if
    @PratapKumar-sm9if 6 месяцев назад

    Hi Serge,
    I have followed your tutorial, However, Kube Proxy status shows a Crashloop error
    Any suggestion Please ?
    Thanks

    • @LearnDevOpswithSerge
      @LearnDevOpswithSerge  6 месяцев назад

      Hi, I guess you mean Flannel when talking about kube proxy.
      1. Check logs of the crashed container: "kubectl -n logs -p "
      2. Check events of the pod in the 'CrashLoopBackOff' state: "kubectl -n describe pod "
      3. Analyze the information from the 1st and 2d list items.

  • @shang-mokai5428
    @shang-mokai5428 5 месяцев назад

    Thanks You Very Much !!! working well for me

  • @timetraveller2045
    @timetraveller2045 6 месяцев назад

    Many Thanks! Very usefull video!

    • @IndianSumaira
      @IndianSumaira 5 месяцев назад

      did it worked for you ? I am facing some trouble when i try to init cluster, says its: st:10248/healthz": dial tcp 127.0.0.1:10248: connect: connection refused.
      Unfortunately, an error has occurred:
      timed out waiting for the condition
      This error is likely caused by:
      - The kubelet is not running
      - The kubelet is unhealthy due to a misconfiguration of the node in some way (required cgroups disabled)
      If you are on a systemd-powered system, you can try to troubleshoot the error with the following commands:
      - 'systemctl status kubelet'
      - 'journalctl -xeu kubelet'
      Additionally, a control plane component may have crashed or exited when started by the container runtime.
      To troubleshoot, list all containers using your preferred container runtimes CLI.
      Here is one example how you may list all running Kubernetes containers by using crictl:
      - 'crictl --runtime-endpoint unix:///var/run/containerd/containerd.sock ps -a | grep kube | grep -v pause'
      Once you have found the failing container, you can inspect its logs with:
      - 'crictl --runtime-endpoint unix:///var/run/containerd/containerd.sock logs CONTAINERID'
      error execution phase wait-control-plane: couldn't initialize a Kubernetes cluster
      To see the stack trace of this error execute with --v=5 or higher

  • @magicalvibez2037
    @magicalvibez2037 6 месяцев назад

    how did u created the master and worker nodes?

  • @suryagowda3663
    @suryagowda3663 4 месяца назад

    Hi , i want to learn step by step about kubernetes with syllabus. Can u share here...

  • @sumanth6114
    @sumanth6114 5 месяцев назад

    dude at 3:49 its big command where can i get that?

    • @LearnDevOpswithSerge
      @LearnDevOpswithSerge  5 месяцев назад

      Hi,
      containerd config default | sed 's/SystemdCgroup = false/SystemdCgroup = true/' | sed 's/sandbox_image = "registry.k8s.io\/pause:3.6"/sandbox_image = "registry.k8s.io\/pause:3.9"/' | sudo tee /etc/containerd/config.toml

  • @bololo4988
    @bololo4988 4 месяца назад

    why you not have error invalid argumen with command sudo sysctl --system

    • @LearnDevOpswithSerge
      @LearnDevOpswithSerge  4 месяца назад

      Hi, this command is correct:
      $ sysctl --help | grep system
      --system read values from all system directories

  • @suryagowda3663
    @suryagowda3663 4 месяца назад

    What is kubeadm? What is the use? When we should use?

  • @knvssandeepbolisetti5008
    @knvssandeepbolisetti5008 8 месяцев назад +1

    Thank You Very Much.

  • @zemarisco
    @zemarisco 4 месяца назад

    love you Serge

  • @ramankhanna9526
    @ramankhanna9526 8 месяцев назад +2

    thankyou

  • @sathvikbandaru3985
    @sathvikbandaru3985 6 месяцев назад

    Thanks you

    • @sathvikbandaru3985
      @sathvikbandaru3985 6 месяцев назад

      for me Culster set up is ready because of you but little issue my pods are not running properly when im using flannel but when i using calico now my pods are running

  • @sandeepthapa9478
    @sandeepthapa9478 5 месяцев назад

    containerd config default | sudo tee /etc/containerd/config.toml >/dev/null 2>&1
    $ sudo sed -i 's/SystemdCgroup \= false/SystemdCgroup \= true/g' /etc/containerd/config.toml
    from where did u get this command in k8s documentation

    • @LearnDevOpswithSerge
      @LearnDevOpswithSerge  5 месяцев назад

      Hi,
      1. SystemdCgroup = true # The documentaion about it kubernetes.io/docs/setup/production-environment/container-runtimes/#containerd-systemd
      2. The issue with sandbox image:
      github.com/cri-o/cri-o/issues/6985
      discuss.kubernetes.io/t/can-not-install-kubernetes-cluster-with-kubeadm/24079
      ----
      Note that the version of the sandbox image in each Containerd version can be changed so check it. For example, in my video, the version is 3.6 and now it is 3.8.
      The message while installing Kubernetes:
      W0725 06:32:35.829024 14158 checks.go:844] detected that the sandbox image "registry.k8s.io/pause:3.8" of the container runtime is inconsistent with that used by kubeadm.It is recommended to use "registry.k8s.io/pause:3.9" as the CRI sandbox image.