chg: User from root To vagrant

This commit modifies the instruactions so that
they use the vagrant user instead of root. Also sudo is now
requierd for a significant amount of the commands.
This commit is contained in:
Khalifah Shabazz
2025-06-02 22:13:21 -04:00
parent b1fe36516e
commit 84c96710a3
12 changed files with 279 additions and 186 deletions

View File

@@ -25,7 +25,9 @@ everything up.
### Install Command Line Utilities
Now that you are logged into the `jumpbox` machine as the `root` user, you will install the command line utilities that will be used to preform various tasks throughout the tutorial.
Now that you are logged into the `jumpbox` machine as the `root` user, you will
install the command line utilities that will be used to preform various tasks
throughout the tutorial.
```bash
{
@@ -36,11 +38,14 @@ Now that you are logged into the `jumpbox` machine as the `root` user, you will
### Sync GitHub Repository
Now it's time to download a copy of this tutorial which contains the configuration files and templates that will be used build your Kubernetes cluster from the ground up. Clone the Kubernetes The Hard Way git repository using the `git` command:
Now it's time to download a copy of this tutorial which contains the
configuration files and templates that will be used to build your Kubernetes
cluster from the ground up. Clone the Kubernetes The Hard Way git repository
using the `git` command:
```bash
git clone --depth 1 \
https://github.com/kelseyhightower/kubernetes-the-hard-way.git
https://github.com/b01/kubernetes-the-hard-way.git
```
Change into the `kubernetes-the-hard-way` directory:
@@ -49,27 +54,36 @@ Change into the `kubernetes-the-hard-way` directory:
cd kubernetes-the-hard-way
```
This will be the working directory for the rest of the tutorial. If you ever get lost run the `pwd` command to verify you are in the right directory when running commands on the `jumpbox`:
This will be the working directory for the rest of the tutorial. If you ever
get lost run the `pwd` command to verify you are in the right directory when
running commands on the `jumpbox`:
```bash
pwd
```
```text
/root/kubernetes-the-hard-way
/home/vagrant/kubernetes-the-hard-way
```
### Download Binaries
In this section you will download the binaries for the various Kubernetes components. The binaries will be stored in the `downloads` directory on the `jumpbox`, which will reduce the amount of internet bandwidth required to complete this tutorial as we avoid downloading the binaries multiple times for each machine in our Kubernetes cluster.
In this section you will download the binaries for the various Kubernetes
components. The binaries will be stored in the `downloads` directory on the
`jumpbox`, which will reduce the amount of internet bandwidth required to
complete this tutorial as we avoid downloading the binaries multiple times
for each machine in our Kubernetes cluster.
The binaries that will be downloaded are listed in either the `downloads-amd64.txt` or `downloads-arm64.txt` file depending on your hardware architecture, which you can review using the `cat` command:
The binaries that will be downloaded are listed in either the
`downloads-amd64.txt` or `downloads-arm64.txt` file depending on your hardware
architecture, which you can review using the `cat` command:
```bash
cat downloads-$(dpkg --print-architecture).txt
```
Download the binaries into a directory called `downloads` using the `wget` command:
Download the binaries into a directory called `downloads` using the `wget`
command:
```bash
wget -q --show-progress \
@@ -79,30 +93,40 @@ wget -q --show-progress \
-i downloads-$(dpkg --print-architecture).txt
```
Depending on your internet connection speed it may take a while to download over `500` megabytes of binaries, and once the download is complete, you can list them using the `ls` command:
Depending on your internet connection speed it may take a while to download
over `500` megabytes of binaries, and once the download is complete, you can
list them using the `ls` command:
```bash
ls -oh downloads
```
Extract the component binaries from the release archives and organize them under the `downloads` directory.
Extract the component binaries from the release archives and organize them
under the `downloads` directory.
```bash
{
KUBE_VER=v1.33.1
CRI_VER=v1.33.0
RUNC_VER=v1.3.0
CNI_VER=v1.7.1
CONTAINERD_VER=2.1.1
ETCD_VER=v3.6.0
ARCH=$(dpkg --print-architecture)
mkdir -p downloads/{client,cni-plugins,controller,worker}
tar -xvf downloads/crictl-v1.32.0-linux-${ARCH}.tar.gz \
tar -xvf downloads/crictl-${CRI_VER}-linux-${ARCH}.tar.gz \
-C downloads/worker/
tar -xvf downloads/containerd-2.1.0-beta.0-linux-${ARCH}.tar.gz \
tar -xvf downloads/containerd-${CONTAINERD_VER}-linux-${ARCH}.tar.gz \
--strip-components 1 \
-C downloads/worker/
tar -xvf downloads/cni-plugins-linux-${ARCH}-v1.6.2.tgz \
tar -xvf downloads/cni-plugins-linux-${ARCH}-${CNI_VER}.tgz \
-C downloads/cni-plugins/
tar -xvf downloads/etcd-v3.6.0-rc.3-linux-${ARCH}.tar.gz \
tar -xvf downloads/etcd-${ETCD_VER}-linux-${ARCH}.tar.gz \
-C downloads/ \
--strip-components 1 \
etcd-v3.6.0-rc.3-linux-${ARCH}/etcdctl \
etcd-v3.6.0-rc.3-linux-${ARCH}/etcd
etcd-${ETCD_VER}-linux-${ARCH}/etcdctl \
etcd-${ETCD_VER}-linux-${ARCH}/etcd
mv downloads/{etcdctl,kubectl} downloads/client/
mv downloads/{etcd,kube-apiserver,kube-controller-manager,kube-scheduler} \
downloads/controller/
@@ -125,17 +149,22 @@ Make the binaries executable.
### Install kubectl
In this section you will install the `kubectl`, the official Kubernetes client command line tool, on the `jumpbox` machine. `kubectl` will be used to interact with the Kubernetes control plane once your cluster is provisioned later in this tutorial.
In this section you will install the `kubectl`, the official Kubernetes client
command line tool, on the `jumpbox` machine. `kubectl` will be used to interact
with the Kubernetes control plane once your cluster is provisioned later in
this tutorial.
Use the `chmod` command to make the `kubectl` binary executable and move it to the `/usr/local/bin/` directory:
Use the `chmod` command to make the `kubectl` binary executable and move it to
the `/usr/local/bin/` directory:
```bash
{
cp downloads/client/kubectl /usr/local/bin/
sudo cp downloads/client/kubectl /usr/local/bin/
}
```
At this point `kubectl` is installed and can be verified by running the `kubectl` command:
At this point `kubectl` is installed and can be verified by running the
`kubectl` command:
```bash
kubectl version --client
@@ -143,9 +172,10 @@ kubectl version --client
```text
Client Version: v1.33.1
Kustomize Version: v5.5.0
Kustomize Version: v5.6.0
```
At this point the `jumpbox` has been set up with all the command line tools and utilities necessary to complete the labs in this tutorial.
At this point the `jumpbox` has been set up with all the command line tools
and utilities necessary to complete the labs in this tutorial.
Next: [Provisioning Compute Resources](03-compute-resources.md)