Welcome to the Linux Foundation Forum!

2.2 CP Setup Script Error

Posts: 3
edited June 2023 in LFD259 Class Forum

Hi there and thanks for helping.

I'm using the following virtual machine setup on Mac M1 chip.

  1. $ multipass info --all
  2. Name: cp
  3. State: Running
  4. IPv4: 192.168.64.6
  5. 172.17.0.1
  6. Release: Ubuntu 20.04.6 LTS
  7. Image hash: 6de60c14be0f (Ubuntu 20.04 LTS)
  8. CPU(s): 2
  9. Load: 0.24 0.16 0.10
  10. Disk usage: 2.3GiB out of 20.3GiB
  11. Memory usage: 273.4MiB out of 7.8GiB
  12. Mounts: --

With this, I'm getting some errors on the LFD259/SOLUTIONS/s_02/k8scp.sh script. I've been executing the script line by line and the first errors come up here.

  1. # Install the containerd software
  2. $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
  3. $ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
  4. $ sudo apt-get update
  5. $ sudo apt-get install containerd.io -y
  6. Reading package lists... Done
  7. Building dependency tree
  8. Reading state information... Done
  9. E: Unable to locate package containerd.io
  10. E: Couldn't find any package by glob 'containerd.io'
  11. E: Couldn't find any package by regex 'containerd.io'

I got around this by running

  1. $ sudo apt-get install containerd -y

but then...

  1. ubuntu@cp:~$ sudo crictl config --set runtime-endpoint=unix:///run/containerd/containerd.sock --set image-endpoint=unix:///run/containerd/containerd.sock
  2. /usr/local/bin/crictl: 1: Syntax error: end of file unexpected (expecting ")")
  3. ubuntu@cp:~$ sudo kubeadm init --pod-network-cidr=192.168.0.0/16 | sudo tee /var/log/kubeinit.log
  4.  
  5. [init] Using Kubernetes version: v1.27.3
  6. [preflight] Running pre-flight checks
  7. error execution phase preflight: [preflight] Some fatal errors occurred:
  8. [ERROR CRI]: container runtime is not running: output: , error: executable file not found in $PATH
  9. [preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`
  10. To see the stack trace of this error execute with --v=5 or higher

Can somebody please help me troubleshoot this?

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Answers

  • Posts: 2,443

    Hi @johannespn,

    I remember some strange behaviors reported a while back on environments provisioned with multipass. You may find some tips in those earlier posts.
    One thing I'd recommend however, to not assign 192.168.x.y IP addresses to your VMs, because that very same private network will be used for the application pods network layer, and such overlaps will cause routing conflicts in your cluster.

    I just ran the installation steps, and it seems that the recommended containerd.io package from Docker repo installs just fine. It is the most up to date package, as opposed to the containerd package downloaded from Ubuntu repo, that may be older. On M1 you may run into issues with some container images not supporting the chipset, so you'd need to find alternate images built specifically for the ARM architecture.

    Regards,
    -Chris

  • Posts: 3
    edited June 2023

    Hi and thanks a lot, I solved by running my cluster on AWS instead. The costs are quite cheap :)

  • Hi,
    I was having the same issue with installation today. I've modified the script slightly so now it runs on arm64 architecture without any errors.
    https://gist.github.com/kindejak/a16ee99e92e8e98c265f5256f6902f58

    1. #!/bin/bash
    2. # ###############################################################
    3. # NOTE: This script was slightly edited by Jakub Kindermann on 16/11/2023 to run the script on arm64-linux architecture
    4. ################# LFD459:1.25.1 s_02/k8scp.sh ################
    5. # The code herein is: Copyright the Linux Foundation, 2022
    6. #
    7. # This Copyright is retained for the purpose of protecting free
    8. # redistribution of source.
    9. #
    10. # URL: https://training.linuxfoundation.org
    11. # email: info@linuxfoundation.org
    12. #
    13. # This code is distributed under Version 2 of the GNU General Public
    14. # License, which you should have received with the source.
    15. #Version 1.26.1
    16. #
    17. # This script is intended to be run on an Ubuntu 20.04,
    18. # 2cpu, 8G.
    19. # By Tim Serewicz, 05/2022 GPL
    20.  
    21. # Note there is a lot of software downloaded, which may require
    22. # some troubleshooting if any of the sites updates their code,
    23. # which should be expected
    24.  
    25.  
    26. # Check to see if the script has been run before. Exit out if so.
    27. FILE=/k8scp_run
    28. if [ -f "$FILE" ]; then
    29. echo "WARNING!"
    30. echo "$FILE exists. Script has already been run on control plane."
    31. echo
    32. exit 1
    33. else
    34. echo "$FILE does not exist. Running script"
    35. fi
    36.  
    37.  
    38. # Create a file when this script is started to keep it from running
    39. # twice on same node
    40. sudo touch /k8scp_run
    41.  
    42. # Update the system
    43. sudo apt-get update ; sudo apt-get upgrade -y
    44.  
    45. # Install necessary software
    46. sudo apt-get install curl apt-transport-https vim git wget gnupg2 software-properties-common apt-transport-https ca-certificates -y
    47.  
    48. # Add repo for Kubernetes
    49. curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
    50. echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
    51.  
    52. # Install the Kubernetes software, and lock the version
    53. sudo apt-get update
    54. sudo apt-get -y install kubelet=1.28.1-00 kubeadm=1.28.1-00 kubectl=1.28.1-00
    55. sudo apt-mark hold kubelet kubeadm kubectl
    56.  
    57. # Ensure Kubelet is running
    58. sudo systemctl enable --now kubelet
    59.  
    60. # Disable swap just in case
    61. sudo swapoff -a
    62.  
    63. # Ensure Kernel has modules
    64. sudo modprobe overlay
    65. sudo modprobe br_netfilter
    66.  
    67. # Update networking to allow traffic
    68. cat <<EOF | sudo tee /etc/sysctl.d/kubernetes.conf
    69. net.bridge.bridge-nf-call-ip6tables = 1
    70. net.bridge.bridge-nf-call-iptables = 1
    71. net.ipv4.ip_forward = 1
    72. EOF
    73.  
    74. sudo sysctl --system
    75.  
    76. # Configure containerd settings
    77. cat <<EOF | sudo tee /etc/modules-load.d/containerd.conf
    78. overlay
    79. br_netfilter
    80. EOF
    81.  
    82. sudo sysctl --system
    83.  
    84.  
    85. export CLI_ARCH=amd64
    86.  
    87. # Ensure correct architecture
    88. if [ "$(uname -m)" = "aarch64" ]; then CLI_ARCH=arm64; fi
    89.  
    90.  
    91. # Install the containerd software
    92. curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
    93. sudo add-apt-repository "deb [arch=${CLI_ARCH}] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
    94. sudo apt-get update
    95. sudo apt-get install containerd.io -y
    96.  
    97. # Configure containerd and restart
    98. sudo mkdir -p /etc/containerd
    99. containerd config default | sudo tee /etc/containerd/config.toml
    100. sudo sed -e 's/SystemdCgroup = false/SystemdCgroup = true/g' -i /etc/containerd/config.toml
    101. sudo systemctl restart containerd
    102. sudo systemctl enable containerd
    103.  
    104.  
    105. # Create the config file so no more errors
    106. # Install and configure crictl
    107. export VER="v1.26.0"
    108.  
    109. wget https://github.com/kubernetes-sigs/cri-tools/releases/download/$VER/crictl-$VER-linux-$CLI_ARCH.tar.gz
    110.  
    111. tar zxvf crictl-$VER-linux-$CLI_ARCH.tar.gz
    112.  
    113. sudo mv crictl /usr/local/bin
    114.  
    115. # Set the endpoints to avoid the deprecation error
    116. sudo crictl config --set \
    117. runtime-endpoint=unix:///run/containerd/containerd.sock \
    118. --set image-endpoint=unix:///run/containerd/containerd.sock
    119.  
    120. # Configure the cluster
    121. sudo kubeadm init --pod-network-cidr=192.168.0.0/16 | sudo tee /var/log/kubeinit.log
    122.  
    123. # Configure the non-root user to use kubectl
    124. mkdir -p $HOME/.kube
    125. sudo cp -f /etc/kubernetes/admin.conf $HOME/.kube/config
    126. sudo chown $(id -u):$(id -g) $HOME/.kube/config
    127.  
    128. # Use Cilium as the network plugin
    129. # Install the CLI first
    130. export CILIUM_CLI_VERSION=$(curl -s https://raw.githubusercontent.com/cilium/cilium-cli/master/stable.txt)
    131. curl -L --fail --remote-name-all https://github.com/cilium/cilium-cli/releases/download/${CILIUM_CLI_VERSION}/cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum}
    132.  
    133. # Make sure download worked
    134. sha256sum --check cilium-linux-${CLI_ARCH}.tar.gz.sha256sum
    135.  
    136. # Move binary to correct location and remove tarball
    137. sudo tar xzvfC cilium-linux-${CLI_ARCH}.tar.gz /usr/local/bin
    138. rm cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum}
    139.  
    140. # Now that binary is in place, install network plugin
    141. echo '********************************************************'
    142. echo '********************************************************'
    143. echo
    144. echo Installing Cilium, this may take a bit...
    145. echo
    146. echo '********************************************************'
    147. echo '********************************************************'
    148. echo
    149.  
    150. cilium install
    151.  
    152. echo
    153. sleep 3
    154. echo Cilium install finished. Continuing with script.
    155. echo
    156.  
    157.  
    158. # Add Helm to make our life easier
    159. wget https://get.helm.sh/helm-v3.11.1-linux-${CLI_ARCH}.tar.gz
    160. tar -xf helm-v3.11.1-linux-amd64.tar.gz
    161. sudo cp linux-amd64/helm /usr/local/bin/
    162.  
    163. sleep 15
    164. # Output the state of the cluster
    165. kubectl get node
    166.  
    167. # Ready to continue
    168. sleep 3
    169. echo
    170. echo
    171. echo '***************************'
    172. echo
    173. echo "Continue to the next step"
    174. echo
    175. echo '***************************'
    176. echo

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Categories

Upcoming Training