Kubernetes Bootcamp (CKAD)
Hi, I’m Pius Lawal, and this course is part of my Hybrid and Multi-Cloud Developer bootcamp series.
A hybrid and multi-cloud skill is useful on-prem as well as on any cloud platform. You might learn these skills locally, or on a particular cloud platform, yet remain a ninja 🥷 in any cloud environment - Docker is a popular example.
If you like this project, but just don’t have time to contribute, that’s fine. There are other easy ways to support the project and show your appreciation:
- Star this project
- Tweet about it
- Reference this project in your own work
- Mention this project at local meetups and to your family/friends/colleagues

Learning Outcomes
This bootcamp covers the Certified Kubernetes Application Developer (CKAD) exam curriculum plus more. In summary, you will be learning cloud application development, which is a modern approach to building and running software applications that exploits the flexibility, scalability, and resilience of cloud computing. Some highlights include:
- proficiency working on the command-line
- proficiency working with containers
- proficiency working with Kubernetes
- microservices architecture
- devops with Kubernetes
Ace the CKAD Exam
Passing the CKAD exam with confidence should be a simple 4-stage process, all of which is covered in this bootcamp:
- Learn the CKAD exam curriculum content by your preferred method
- Learn how to troubleshoot all the resources covered in the curriculum
- Familiarity with the exam-language and common exam tips
- Proficiency with
kubectl and related CLI tools
FAQs
How will this work?
Follow the Labs, that’s all!
No prior experience required and its okay if you’re not confident on the command-line, yet!
Each chapter contains several Labs to help you slowly build confidence and proficiency around the concepts covered. There are command snippet blocks provided to help you through the Labs - use them if you’re stuck on any Lab and aren’t yet confident using help on the terminal.
There are Tasks provided at the end of most chapters with content designed to challenge your critical understanding and troubleshooting strategy of the core concepts in that chapter. These Tasks are longer and require more time to solve than standard exam questions, which makes them more difficult. Therefore, you know you are exam-ready if you can complete all 16 Tasks under 2 hours.
What else do I need to pass CKAD?
Nothing else, this bootcamp is an All-In-One-Guide! Simply working through this bootcamp will make you proficient with Kubernetes as well as prepare you for the CKAD exam!
The Exam Readiness Mode, where you simulate the exam by completing all 16 Tasks under 2 hours, will help you identify your weak areas. Then you simply repeat those chapters/sections, and make sure to review all links to resources from the official Kubernetes documentation, until you are confident.
I know Kubernetes already?
If you have completed step [1] above, for example, you have completed a CKAD course prior or use Kubernetes day-to-day, etc, and just wish to dive into Exam Readiness Mode, skip to Ch15 - Exam tips.
I know Docker already?
Great! Then you can skip to Chapter 2: Task - Docker image
I only want Kubernetes not CKAD?
Hey! CKAD is entry-level Kubernetes and covers the basic features and core components of Kubernetes. This bootcamp covers everything you need from NOOB setup to mastery. Preparing for the CKAD exam is a structured approach to learning Kubernetes. When you finish this bootcamp, you may choose not to pay for and sit the exam, but you will have acquired the ability to pass regardless.
CKAD exam curriculum?
In the CKAD exam, you will have 2 hours to complete 15-20 performance-based questions around the areas below.

Where is Table of Contents (TOC)?
GitHub has native TOC support for markdown files with filtering built-in. The TOC Header sticks to the top of the page as you scroll through the document.

Requirements
A Unix-based environment running docker (Docker Engine or Docker Desktop).
macOS users
# 1. install xcode tools
sudo xcode-select --install
# 2. install homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# 3. install docker
brew install --cask docker
Windows users
# powershell as administrator
# 1. install wsl2
wsl --install
# 2. install terminal
winget install Microsoft.WindowsTerminal
# 3. install docker
winget install Docker.DockerDesktop
# restart device
After device restart:
-
Complete Ubuntu user setup - Ubuntu terminal should auto-open
-
Enable systemd:
sudo nano /etc/wsl.conf
# /etc/wsl.conf
[boot]
systemd=true
wsl.exe --terminate Ubuntu
-
Enable Docker Desktop integration with WSL2 Ubuntu
-
Open Terminal and switch to Ubuntu
-
Make Ubuntu your default Terminal profile
-
Perform Internet connection test in WSL2 by running:
curl google.com
💡 If connection fails with Could not resolve host, and you have a VPN program installed, see WSL2 VPN fix below
WSL2 VPN fix
See wsl-vpnkit documentation for more details.
# powershell as administrator
wget -o wsl-vpnkit.tar.gz https://github.com/sakai135/wsl-vpnkit/releases/latest/download/wsl-vpnkit.tar.gz
wsl --import wsl-vpnkit $env:USERPROFILE\wsl-vpnkit wsl-vpnkit.tar.gz --version 2
# wsl2 ubuntu
wsl.exe -d wsl-vpnkit --cd /app cat /app/wsl-vpnkit.service | sudo tee /etc/systemd/system/wsl-vpnkit.service
sudo systemctl enable wsl-vpnkit
sudo systemctl start wsl-vpnkit
systemctl status wsl-vpnkit # should be Active
# test internet connection again
curl google.com
Debian users (and Windows without Docker Desktop)
See Install Docker Engine documentation for more details and other distro steps.
This is also an alternative for Windows users running WSL2.
💡 If using WSL2, be sure to:
- Enable
systemd - see the Windows users section
- If installed, disable Docker Desktop integration with WSL2
# 1. uninstall old docker versions
sudo apt-get remove docker docker-engine docker.io containerd runc
# 2. setup docker repository
sudo apt-get update
sudo apt-get -y install ca-certificates curl gnupg lsb-release
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# 3. install docker engine
sudo apt-get update
sudo apt-get -y install docker-ce docker-ce-cli containerd.io docker-compose-plugin
# 4. manage docker as non-root user
sudo groupadd docker
sudo usermod -aG docker $USER
# 5. start a new terminal to update group membership
docker run hello-world
1. Understanding and Using Containers
A container is a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another. A container-runtime, which relies on the host kernel, is required to run a container.
Docker is the most popular container-runtime and container-solution, but there are other runtimes like runc, cri-o, containerd, etc, However, the only significant container-solutions today are Docker and Podman
A container image is a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries and settings. Container images become containers at runtime.
The Open Container Initiative (OCI) creates open industry standards around container formats and runtimes.
A container registry is a repository, or collection of repositories, used to store and access container images. Container registries are a big player in cloud application development, often as part of GitOps processes.
Basic docker commands
# run busybox container, see `docker run --help`
docker run busybox
# run in interactive mode
docker run -it busybox
# run in interactive mode and delete container when stopped
docker run -it --rm busybox
# run in detached mode
docker run -d busybox
# list running containers
docker ps
# list all containers
docker ps -a
# start a stopped container, see `docker container start --help`
docker container start $CONTAINER_NAME_OR_ID
# stop a running container, see `docker container stop --help`
docker container stop $CONTAINER_NAME_OR_ID
# restart a running container, see `docker container restart --help`
docker container restart $CONTAINER_NAME_OR_ID
# delete a stopped container, see `docker container rm --help`
docker container rm $CONTAINER_NAME_OR_ID
# exit running container - container is stopped if connected to entrypoint
exit
# exit running container without stopping it
ctrl-p ctrl-q
See possible container statuses to understand more about container states
Lab 1.1. Hello docker
- Run
docker info to confirm docker client and server statuses
- Run
docker run hello-world
Lab 1.2. First container interaction
## view kernel details
uname -r # or `cat /proc/version` or `hostnamectl`
# view os version
cat /etc/*-release # or redhat `/etc/redhat-release`, other unix-based os `/etc/os-release`
# view running processes, see `ps --help`
ps aux
# view processes, alternative to `ps`
ls /proc # to find PID, then
cat /proc/$PID/cmdline
- Run
ps aux to review running processes on your host device
- Run a
busybox container in interactive mode docker run -it busybox
- Review the container kernel details
- Review the running processes in the container and note PID
- Exit the container
- List running containers
- List all containers
- Repeat [2] and exit the container without stopping it
- List running containers
- List all containers
- Delete the containers
lab1.2 solution
# host terminal
ps aux
docker run --name box1 -it busybox
# container terminal
ps aux
uname -r
cat /proc/version
hostnamectl # not found
cat /etc/*-release # not found
busybox | head
exit
# host terminal
docker ps
docker ps -a
docker run --name box2 -it busybox
# container terminal
ctrl+p ctrl+q
# host terminal
docker ps
docker ps -a
docker stop box2
docker rm box1 box2
docker ps showing STATUS of Exited (0) means exit OK, but an Exit STATUS that’s not 0 should be investigated docker logs
CTRL+P, CTRL+Q only works when running a container in interactive mode, see how to attach/detach containers for more details
Lab 1.3. Entering and exiting containers
# run container with specified name
docker run -d --name webserver httpd
# run command `date` in a new container
docker run busybox date
# get a "dash" shell to a running container, see `docker exec --help`
docker exec -it $CONTAINER_NAME_OR_ID sh
# get a "bash" shell to a running container
docker exec -it $CONTAINER_NAME_OR_ID bash
# view open ports, the commands below only work if installed in the container
netstat -tupln # see `netstat --help` - t tcp, u udp, p program-names, l listening, n port-numbers-only
ss -tulpn # see `ss --help`, alternative to netstat
- Run a
nginx container
- List running containers (use another terminal if stuck)
- Exit the container
- List running containers
- Run another
nginx container in interactive mode
- Review container kernel details
- Review running processes in the container
- Exit container
- Run another
nginx container in detached mode
- List running containers
- Connect a shell to the new container interactively
- View open ports in the container
- Exit the container
- List running containers
- Delete all containers
lab1.3 solution
# host terminal
docker run --name webserver1 nginx
# host second terminal
docker ps
# host terminal
ctrl+c
docker ps
docker run --name webserver2 -it --rm nginx bash
# container terminal
cat /etc/*-release
ps aux # not found
ls /proc
ls /proc/1 # list processes running on PID 1
cat /proc/1/$PROCESS_NAME
exit
# host terminal
docker run --name webserver3 -d nginx
docker ps
docker exec -it webserver3 bash
# container terminal
netstat -tupln
ss -tulpn
exit
# host terminal
docker ps
docker stop webserver3
docker rm webserver1 webserver2 webserver3
Containers may not always have bash shell, but will usually have the dash shell sh
Lab 1.4. Container arguments
- Run a
busybox container with command sleep 30 as argument, see sleep --help
- List running containers (use another terminal if stuck)
- Exit container (note that container will auto exit after 30s)
- Run another
busybox container in detached mode with command sleep 300 as argument
- List running containers
- Connect to the container to execute commands
- Exit container
- List running containers
- Run another
busybox container in detached mode, no commands
- List running containers
- List all containers
- Delete all containers
lab1.4 solution
# host terminal
docker run --name box1 busybox sleep 30
# host second terminal
docker ps
docker stop box1
# host terminal
docker run --name box2 -d busybox sleep 300
docker ps
docker exec -it box2 sh
# container terminal
exit
# host terminal
docker ps
docker run --name box3 -d busybox
docker ps
docker ps -a
docker stop box2
docker rm box1 box2 box3
The Entrypoint of a container is the init process and allows the container to run as an executable. Commands passed to a container are passed to the container’s entrypoint process.
Note that docker commands after $IMAGE_NAME are passed to the container’s entrypoint as arguments.
❌ docker run -it mysql -e MYSQL_PASSWORD=hello will pass -e MYSQL_PASSWORD=hello to the container
✔️ docker run -it -e MYSQL_PASSWORD=hello mysql
Managing containers and images
# run container with port, see `docker run --help`
docker run -d -p 8080:80 httpd # visit localhost:8080
# run container with mounted volume
docker run -d -p 8080:80 -v ~/html:/usr/local/apache2/htdocs httpd
# run container with environment variable
docker run -e MONGO_INITDB_ROOT_USERNAME=admin -e MONGO_INITDB_ROOT_PASSWORD=secret mongo
# inspect container, see `docker container inspect --help | docker inspect --help`
docker inspect $CONTAINER_NAME_OR_ID | less # press Q key to quit from less
docker container inspect $CONTAINER_NAME_OR_ID
# format inspect output to view container network information
docker inspect --format="{{.NetworkSettings.IPAddress}}" $CONTAINER_NAME_OR_ID
# format inspect output to view container status information
docker inspect --format="{{.State.Pid}}" $CONTAINER_NAME_OR_ID
# view container logs, see `docker logs --help`
docker logs $CONTAINER_NAME_OR_ID
# remove all unused data (including dangling images)
docker system prune
# remove all unused data (including unused images, dangling or not, and volumes)
docker system prune --all --volumes
# manage images, see `docker image --help`
docker image ls # or `docker images`
docker image inspect $IMAGE_ID
docker image rm $IMAGE_ID
# see `docker --help` for complete resources
Lab 1.5. Container ports and IP
- Run a
nginx container with name webserver
- Inspect the container (use
| less to avoid console clutter) and review the State and NetworkSettings fields, quit with q
- Visit
http://$CONTAINER_IP_ADDRESS in your browser (this may not work depending on your envrionment network settings)
- Run another
nginx container with name webserver and exposed on port 80
- Visit localhost in your browser
- Delete the containers
lab1.5 solution
# host terminal
docker run -d --name webserver nginx
docker inspect webserver | grep -A 13 '"State"' | less
docker inspect webserver | grep -A 50 '"NetworkSettings"' | less
curl http://$(docker inspect webserver --format "{{.NetworkSettings.IPAddress}}") | less
docker stop webserver
docker rm webserver
docker run -d --name webserver -p 80:80 nginx
curl localhost | less
docker ps
docker ps -a
docker stop webserver
docker rm webserver
Always run containers in detached mode to avoid getting stuck in the container STDOUT
Lab 1.6. Container volumes
- Create an
html/index.html file with some content
- Run any webserver containers on port 8080 and mount the
html folder to the DocumentRoot
- option
nginx DocumentRoot - /usr/share/nginx/html
- option
httpd DocumentRoot - /usr/local/apache2/htdocs
- Visit localhost:8080
- List running containers
- List all containers
- Delete containers
lab1.6 solution
# host terminal
cd ~
mkdir html
echo "Welcome to Lab 1.6 Container volumes" >> html/index.html
# with nginx
docker run -d --name webserver -v ~/html:/usr/share/nginx/html -p 8080:80 nginx
# with httpd
# docker run -d --name webserver -v ~/html:/usr/local/apache2/htdocs -p 8080:80 httpd
curl localhost:8080
docker ps
docker ps -a
docker stop webserver
docker rm webserver
Lab 1.7. Container environment variables
- Run a
mysql container in detached mode
- Connect to the container
- Review the container logs and resolve the output message regarding environment variable
- Confirm issue resolved by connecting to the container
- Exit the container
- List running containers
- List all containers
- List all images
- List all volumes
- Clean up with
docker system prune
- Check all resources are deleted, containers, images and volumes.
lab1.7 solution
# host terminal
docker run -d --name db mysql
docker exec -it db bash # error not running
docker logs db
docker rm db
docker run -d --name db -e MYSQL_ROOT_PASSWORD=secret mysql
docker ps
docker ps -a
docker image ls
docker volume ls
docker stop db
docker ps # no containers running
docker system prune --all --volumes
docker image ls
docker volume ls
You don’t always have to run a new container, we have had to do this to apply new configuration. You can restart an existing container docker ps -a, if it meets your needs, with docker start $CONTAINER
Lab 1.8. Container registries
Explore Docker Hub and search for images you’ve used so far or images/applications you use day-to-day, like databases, environment tools, etc.
Container images are created with instructions that determine the default container behaviour at runtime. A familiarity with specific images/applications may be required to understand their default behaviours
2. Managing Container Images
A docker image consist of layers, and each image layer is its own image. An image layer is a change on an image - every command (FROM, RUN, COPY, etc.) in your Dockerfile (aka Containerfile by OCI) causes a change, thus creating a new layer. It is recommended reduce your image layers as best possible, e.g. replace multiple RUN commands with “command chaining” apt update && apt upgrade -y.
A name can be assigned to an image by “tagging” the image. This is often used to identify the image version and/or registry.
# to view image layers/history, see `docker image history --help`
docker image history $IMAGE_ID
# tagging images, see `docker tag --help`
docker tag $IMAGE_NAME $NEW_NAME:$TAG # if tag is omitted, `latest` is used
docker tag nginx nginx:1.1
# tags can also be used to add repository location
docker tag nginx domain.com/nginx:1.1
Lab 2.1. Working with images
- List all images (if you’ve just finished lab1.7, run new container to download an image)
- Inspect one of the images with
| less and review the ContainerConfig and Config
- View the image history
- Tag the image with the repository
localhost and a version
- List all images
- View the tagged image history
- Delete tagged image by ID
- Lets try that again, delete tagged image by tag
lab2.1 solution
# host terminal
docker image ls
# using nginx image
docker image inspect nginx | grep -A 40 ContainerConfig | less
docker image inspect nginx | grep -A 40 '"Config"' | less
docker image history nginx
docker tag nginx localhost/nginx:1.1
docker image ls
docker image history localhost/nginx:1.1 # tagging isn't a change
docker image rm $IMAGE_ID # error conflict
docker image rm localhost/nginx:1.1 # deleting removes tag
Lab 2.2. Custom images
Although, we can also create an image from a running container using docker commit, we will only focus on using a Dockerfile, which is the recommended method.
Build the below Dockerfile with docker build -t $IMAGE_NAME:$TAG /path/to/Dockerfile/directory, see `docker build --help
# Example Dockerfile
FROM ubuntu
MAINTAINER Piouson
RUN apt-get update && \
apt-get install -y nmap iproute2 && \
apt-get clean
ENTRYPOINT ["/usr/bin/nmap"]
CMD ["-sn", "172.17.0.0/16"] # nmap will scan docker network subnet `172.17.0.0/16` for running containers
Dockerfile overview
FROM # specify base image
RUN # execute commands
ENV # specify environment variables used by container
ADD # copy files from project directory to the image
COPY # copy files from local project directory to the image - ADD is recommended
ADD /path/to/local/file /path/to/container/directory # specify commands in shell form - space separated
ADD ["/path/to/local/file", "/path/to/container/directory"] # specify commands in exec form - as array (recommended)
USER # specify username (or UID) for RUN, CMD and ENTRYPOINT commands
ENTRYPOINT ["command"] # specify default command, `/bin/sh -c` is used if not specified - cannot be overwritten, so CMD is recommended for flexibility
CMD ["arg1", "arg2"] # specfify arguments to the ENTRYPOINT - if ENTRYPOINT is not specified, args will be passed to `/bin/sh -c`
EXPOSE $PORT # specify container should listen on port $PORT
Lab 2.3. Create image from Dockerfile
See best practices for writing Dockerfile.
# find a package containing an app (debian-based)
apt-file search --regex <filepath-pattern> # requires `apt-file` installation, see `apt-file --help`
apt-file search --regex ".*/sshd$"
# find a package containing an app, if app already installed (debian-based)
dpkg -S /path/to/file/or/pattern # see `dpkg --help`
dpkg -S */$APP_NAME
# find a package containing an app (rpm-based)
dnf provides /path/to/file/or/pattern
dnf provides */sshd
- Create a Dockerfile based on the following:
- Base image should be debian-based or rpm-based
- Should include packages containing
ps application and network utilities like ip, ss and arp
- Should run the
nmap process as the ENTRYPOINT with arguments -sn 172.17.0.0/16
- Build the Dockerfile with repository
local and version 1.0
- List images
- Run separate containers from the image as follows and review behaviour
- do not specify any modes
- in interactive mode with a shell
- in detached mode, then check the logs
- Edit the Dockerfile to run the same process and arguments but not as
ENTRYPOINT
- Repeat all three options in [4] and compare the behaviour
- Clean up
lab2.3 solution
# run ubuntu container to find debian-based packages
docker run -it --rm ubuntu
# container terminal
apt update
apt install -y apt-file
apt-file update
apt-file search --regex "bin/ip$"
apt-file search --regex "bin/ss$"
apt-file search --regex "bin/arp$"
# found `iproute2` and `net-tools`
exit
# alternatively, run fedora container to find rpm-based packages
docker run -it --rm fedora
# container terminal
dnf provides *bin/ip
dnf provides *bin/ss
dnf provides *bin/arp
# found `iproute` and `net-tools`
exit
# host terminal
mkdir test
nano test/Dockerfile
# Dockerfile
FROM alpine
RUN apk add --no-cache nmap iproute2 net-tools
ENTRYPOINT ["/usr/bin/nmap"]
CMD ["-sn", "172.17.0.0/16"]
# host terminal
docker build -t local/alpine:1.0 ./test
docker run --name alps1 local/alpine:1.0
docker run --name alps2 -it local/alpine:1.0 sh
docker run --name alps3 -d local/alpine:1.0
docker log alps3
nano test/Dockerfile
# Dockerfile
FROM alpine
RUN apk add --no-cache nmap iproute2 net-tools
CMD ["/usr/bin/nmap", "-sn", "172.17.0.0/16"]
# host terminal
docker build -t local/alpine:1.1 ./test
docker run --name alps4 local/alpine:1.0
docker run --name alps5 -it local/alpine:1.0 sh
# container terminal
exit
# host terminal
docker run --name alps6 -d local/alpine:1.0
docker log alps6
docker stop alps3 alps5 alps6
docker rm alps1 alps2 alps3 alps4 alps5 alps6
docker image rm local/alpine:1.0 local/alpine:1.1
In most cases, building an image goes beyond a successful build. Some installed packages require additional steps to run containers successfully
Lab 2.4. Containerise your application
See the official language-specific getting started guides which includes NodeJS, Python, Java and Go examples.
- Bootstrap a frontend/backend application project, your choice of language
- Install all dependencies and test the app works
- Create a Dockerfile to containerise the project
- Build the Dockerfile
- Run a container from the image exposed on port 8080
- Confirm you can access the app on localhost:8080
lab2.4 nodejs solution
# host terminal
npx express-generator --no-view test-app
cd test-app
yarn
yarn start # visit localhost:3000 if OK, ctrl+c to exit
echo node_modules > .dockerignore
nano Dockerfile
# Dockerfile
FROM node:alpine
ENV NODE_ENV=production
WORKDIR /app
COPY ["package.json", "yarn.lock", "./"]
RUN yarn --frozen-lockfile --prod
COPY . .
CMD ["node", "bin/www"]
EXPOSE 3000
# host terminal
docker build -t local/app:1.0 .
docker run -d --name app -p 8080:3000 local/app:1.0
curl localhost:8080
docker stop app
docker rm app
docker image rm local/app:1.0
cd ..
rm -rf test-app
Docker container access control
Before we finally go into Kubernetes, it would be advantageous to have a basic understanding of unix-based systems file permissions and access control.
UID and GID
A user identifier (UID) is a unique number assigned to each user. This is how the system identifies each user. The root user has UID of 0, UID 1-500 are often reserved for system users and UID for new users commonly start at 1000. UIDs are stored in the plain-text /etc/passwd file: each line represents a user account, and has seven fields delimited by colons account:password:UID:GID:GECOS:directory:shell.
A group identifier (GID) is similar to UIDs - used by the system to identify groups. A group consists of several users and the root group has GID of 0. GIDs are stored in the plain-text /etc/group file: each line represents a group, and has four fields delimited by colons group:password:GID:comma-separated-list-of-members. An example of creating and assigning a group was covered in requirements - docker installation for debian users where we created and assigned the docker group.
UIDs and GIDs are used to implement Discretionary Access Control (DAC) in unix-based systems by assigning them to files and processes to denote ownership - left at owner’s discretion. This can be seen by running ls -l or ls -ln: the output has seven fields delimited by spaces file_permisions number_of_links user group size date_time_created file_or_folder_name. See unix file permissions for more details.
ls -l in detail

# show current user
whoami
# view my UID and GID, and my group memberships
id
# view the local user database on system
cat /etc/passwd
# output - `account:password:UID:GID:GECOS:directory:shell`
root:x:0:0:root:/root:/bin/bash
piouson:x:1000:1000:,,,:/home/dev:/bin/bash
# view the local group database on system
cat /etc/group
# output - `group:password:GID:comma-separated-list-of-member`
root:x:0:
piouson:x:1000:
docker:x:1001:piouson
# list folder contents and their owner (user/group) names
ls -l
# show ownership by ids, output - `permision number_of_links user group size date_time_created file_or_folder_name`
ls -ln
Capabilities
In the context of permission checks, processes running on unix-based systems are traditionally categorised as:
- privileged processes: effective UID is 0 (root) - bypass all kernel permission checks
- unprivileged processes: effective UID is nonzero - subject to permission checks
Starting with kernel 2.2, Linux further divides traditional root privileges into distinct units known as capabilities as a way to control root user powers. Each root capability can be independently enabled and disabled.
See the overview of Linux capabilities for more details, including a comprehensive list of capabilities.
CAP_SYS_ADMIN is an overloaded capability that grants privileges similar to traditional root privileges
By default, Docker containers are unprivileged and root in a docker container uses restricted capabilities
❌ docker run --privileged gives all capabilities to the container, allowing nearly all the same access to the host as processes running on the host
Running containers as non-root
For practical reasons, most containers run as root by default. However, in a security context, this is bad practice:
- it voilates the principle of least privilege
- an attacker might take advantage of an application vulnerability to gain root access to the container
- an attacker might take advantage of a container-runtime, or kernel, vulnerability to gain root access to the host after gaining access to the container
We can control the users containers run with by:
- omitting the
USER command in Dockerfile assigns root
- specify a user in the
Dockerfile with the USER command
- override the UID at runtime with
docker run --user $UID
# Dockerfile
FROM ubuntu
# create group `piouson`, and create user `piouson` as member of group `piouson`, see `groupadd -h` and `useradd -h`
RUN groupadd piouson && useradd piouson --gid piouson
# specify GID/UID when creating/assigning a group/user
RUN groupadd --gid 1004 piouson && useradd --uid 1004 piouson --gid piouson
# assign user `piouson` for subsequent commands
USER piouson
# create system-group `myapp`, and create system-user `myapp` as member of group `myapp`
RUN groupadd --system myapp && useradd --system --no-log-init myapp --gid myapp
# assign system-user `myapp` for subsequent commands
USER myapp
Lab 2.5. Container privileges
- Display your system’s current user
- Display the current user’s UID, GID and group memberships
- Run a
ubuntu container interactively, and in the container shell:
- display the current user
- display the current user’s UID, GID and group memberships
- list existing user accounts
- list existing groups
- create a file called
test-file and display the file ownership info
- exit the container
- Run a new
ubuntu container interactively with UID 1004, and in the container shell:
- display the current user
- display the current user’s UID, GID and group memberships
- exit the container
- Create a docker image based on
ubuntu with a non-root user as default user
- Run a container interactively using the image, and in the container shell:
- display the current user
- display the current user’s UID, GID and group memberships
- exit the container
- Delete created resources
lab2.5 solution
# host terminal
whoami
id
docker run -it --rm ubuntu
# container terminal
whoami
id
cat /etc/passwd
cat /etc/group
touch test-file
ls -l
ls -ln
exit
# host terminal
docker run -it --rm --user 1004 ubuntu
# container terminal
whoami
id
exit
# test/Dockerfile
FROM ubuntu
RUN groupadd --gid 1000 piouson && useradd --uid 1000 piouson --gid 1000
USER piouson
# host terminal
docker build -t test-image test/
docker run -it --rm test-image
# container terminal
whoami
id
exit
# host terminal
docker image rm test-image
If a containerized application can run without privileges, change to a non-root user
It is recommended to explicitly specify GID/UID when creating a group/user
Task - Docker image
FROM nginx:1.22-alpine
EXPOSE 80
Using docker and the Dockerfile above, build an image with tag bootcamp/nginx:v1 and tag ckad/nginx:latest. Once complete, export a tar file of the image to /home/$USER/ckad-tasks/docker/nginx.tar.
Run a container named web-test from the image bootcamp/nginx:v1 accessible on port 2000, and another container named web-test2 from image ckad/nginx:latest accessible on port 2001. Leave both containers running.
What commands would you use to perform the above operations using podman? Specify these commands on separate lines in file /home/$USER/ckad-tasks/docker/podman-commands
hints
hint 1
You can specify multiple tags when building an image docker build -t tag1 -t tag2 /path//to/dockerfile-directory
hint 2
Try to find the command for exporting a docker image with docker image --help
hint 2
Did you run the containers in detached mode?
hint 3
You can export a docker image to a tar file with docker image save -o /path/to/output/file $IMAGE_NAME
hint 4
Did you expose the required ports when creating the containers? You can use docker run -p $HOST_PORT:$CONTAINER_PORT
hint 5
Did you verify the containers running at exposed ports curl localhost:2000 and curl localhost:2001?
hint 6
Docker and Podman have interchangeable commands, therefore, the only change is docker -> podman, For example, docker run -> podman run, docker build -> podman build, etc.
3. Understanding Kubernetes
K8s is an open-source system for automating deployment, scaling and containerized applications management, currently owned by the Cloud Native Computing Foundation (CNCF).
K8s release cycle is 3 months and deprecated features are supported for a minimum of 2 release cycles (6 months).
You can watch kubernetes in 1 minute for a quick overview
When you’ve got more time, watch/listen to Kubernetes: The Documentary (PART 1 & PART 2)
Lab 3.1. Kubernetes in Google Cloud
A local lab setup is covered in chapter 4 with minikube
Skip this lab if you do not currently have a Google Cloud account with Billing enabled
- Signup and Login to console.cloud.google.com
- Use the “Cluster setup guide” to create “My first cluster”
- Connect to the cluster using the “Cloud Shell”
- View existing Kubernetes resources by running
kubectl get all
Basic Kubernetes API resources
Entities in Kubernetes are recorded in the Kubernetes system as Objects, and they represent the state of your cluster. Kubernetes objects can describe:
- what containerized applications are running (and on which nodes)
- resources available to those applications
- policies around applications behaviour - restarts, upgrades, fault-tolerance, etc
Some common Kubernetes objects include:
- Deployment: represents the application and provides services
- ReplicaSet: manages scalability - array of pods
- Pods: manages containers (note that one container per pod is the standard)
Kubernetes architecture

Pods architecture

# help
kubectl --help | less
# view available resources
kubectl get all, see `kubectl get --help`
# create a deployment, see `kubectl create deploy -h`
kubectl create deploy myapp --image=nginx
# create a deployment with six replicas
kubectl create deploy myapp --image=nginx --replicas=6
# view complete list of supported API resources, shows api-versions and their resource types
kubectl api-resources
# view api-versions only
kubectl api-versions
# delete a deployment, see `kubectl delete --help`
kubectl delete deploy myapp
Lab 3.2. Explore Kubernetes API resources via Google Cloud
This lab is repeated in chapter 4 with minikube
Skip this lab if you do not currently have a Google Cloud account with Billing enabled
- Create an
nginx application with three replicas
- View available resources
- Delete a pod create
- View available resources, how many pods left, can you find the deleted pod?
- List supported API resources
- Delete the application
- view available resource
- Delete the Kubernetes service
- view available resources
- If nothing found, allow 5s and try [9] again
lab3.2 solution
kubectl create deploy webserver --image=nginx --replicas=3
kubectl get all
kubectl delete pod $POD_NAME
kubectl get all # new pod auto created to replace deleted
kubectl api-resources
kubectl delete deploy webserver
kubectl get all
kubectl delete svc kubernetes
kubectl get all # new kubernetes service is auto created to replace deleted
Remember to delete Google cloud cluster to avoid charges if you wish to use a local environment detailed in the next chapter
4. Kubernetes Lab Environment
# check kubernetes version
kubectl version
# list kubernetes context (available kubernetes clusters - docker-desktop, minikube, etc)
kubectl config get-contexts
# switch kubernetes context
kubectl config use-context docker-desktop
Use Docker Desktop
Enable Kubernetes in Docker Desktop settings, then apply and restart

See Docker’s Deploy on Kubernetes for more details
Note that using Docker Desktop will have network limitations when exposing your applications publicly, see alternative Minikube option below
Use Minikube
Minikube is the recommended Kubernetes solution for this course on a local lab environment. See the official minikube installation docs.
Install Minikube on macOS
# 1. install minikube
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-darwin-amd64
sudo install minikube-darwin-amd64 /usr/local/bin/minikube
rm minikube-darwin-amd64
# 2. start a minikube cluster
minikube start
Install Minikube on Windows WSL2
# 1. install minikube
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
chmod +x ./minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube
rm minikube-linux-amd64
# 2. install minikube prereqs - conntrack
sudo apt install conntrack
sudo sysctl fs.protected_regular=0
# 3. start a minikube cluster with the latest kubernetes version and default docker driver
minikube start
# if [3] doesn't work, e.g. vpn issue, etc, try `--driver=none`
# sudo minikube start --driver=none
# 4. change the owner of the .kube and .minikube directories
sudo chown -R $USER $HOME/.kube $HOME/.minikube
Minikube commands
# show current status, see `minikube --help`
minikube status
# open K8s dashboard in local browser
minikube dashboard
# start a minikube cluster with latest k8s version and default driver, see `minikube --help`
minikube start
# start minikube with a specified driver and specified kubernetes version
minikube start --driver=docker --kubernetes-version=1.23.9
# show current IP address
minikube ip
# show current version
minikube version
# connect to minikube cluster
minikube ssh
# list addons
minikube addons list
# enable addons
minikube addons enable $ADDON_NAME
# stop running minikube cluster
minikube stop
# delete stopped minikube cluster
minikube delete
Lab 4.1. Setup minikube and kubectl
- Confirm minikube running
minikube status
- Create
kubectl alias in .bashrcprintf "
# minikube kubectl
alias kubectl='minikube kubectl --'
" >> ~/.bashrc
exec bash
- Start using the alias
kubectl version
kubectl get all
- Enable kubectl autocompletion, see
kubectl completion --helpecho "source <(kubectl completion bash)" >> ~/.bashrc # macos replace bash with zsh
exec bash
- The default
kubectl edit text editor is vi. To change this:export KUBE_EDITOR="nano" # use nano
export KUBE_EDITOR="vim" # use vim
- Open the Kubernetes dashboard with
minikube dashboard
- Use the Kubernetes Dashboard to deploy a webserver with three replicas
- visit url provided in browser
- click on top right plus “+” icon
- select
Create from form
- enter App name:
app, Container image: nginx, Number of pods: 3
- click
Deploy
- Return to the terminal and delete created resources
ctrl+c # to terminate dashboard
kubectl get all
kubectl delete deploy app
- List Kubernetes clusters with
kubectl config get-contexts
- If you have Kubernetes cluster from both Minikube and Docker Desktop, you can switch between them:
- Set Docker Desktop cluster as current cluster:
kubectl config set-context docker-desktop
- Set Minikube cluster as current cluster:
kubectl config set-context minikube
Lab 4.2. Explore Kubernetes API resources via Minikube
- Run an
nginx Pod
- View resources
- Delete the Pod
- View resources
- Repeat Lab 3.2 in Minikube
lab4.2 solution
kubectl run webserver --image=nginx
kubectl get all
kubectl delete pod webserver
kubectl get all # pod gone
# see `lab3.2 solution` for remaining steps
Pods started without a deployment are called Naked Pods - these are not managed by a replicaset, therefore, are not rescheduled on failure, not eligible for rolling updates, cannot be scaled, cannot be replaced automatically.
Although, Naked Pods are not recommended in live environments, they are crucial for learning how to manage Pods, which is a big part of CKAD.
5. Pods
Pods are the smallest deployable units of computing that you can create and manage in Kubernetes.
Managing Pods
# run a pod, see `kubectl run --help`
kubectl run $POD_NAME $IMAGE_NAME
# run a nginx pod with custom args, args are passed to the pod's container's `ENTRYPOINT`
kubectl run mypod --image=nginx -- <arg1> <arg2> ... <argN>
# run a command in an nginx pod
kubectl run mypod --image=nginx --command -- <command>
# run a busybox pod interactively and delete after task completion
kubectl run -it mypod --image=busybox --rm --restart=Never -- date
# to specify the port exposed by the image is 8080
kubectl run mypod --port=8080 --image=image-that-uses-port-8080
# connect a shell to a running pod `mypod`
kubectl exec mypod -it -- sh
# list pods, see `kubectl get --help`
kubectl get pods # using `pod` or `pods` will work
# only show resource names when listing pods
kubectl get pods -o name | less
# display full details of pod in YAML form
kubectl get pods $POD_NAME -o yaml | less
# show details of pod in readable form, see `kubectl describe --help`
kubectl describe pods $POD_NAME | less
# view the pod spec
kubectl explain pod.spec | less
With kubectl, everything after the -- flag is passed to the Pod
💡 -- <args> corresponds to Dockerfile CMD while --command -- <args> corresponds to ENTRYPOINT
See answer to kubectl run --command vs -- arguments for more details
Lab 5.1. Creating Pods
- Create a Pod with
nginx:alpine image and confirm creation
- Review full details of the Pod in YAML form
- Display details of the Pod in readable form and review the Node, IP, container start date/time and Events
- List pods but only show resource names
- Connect a shell to the Pod and confirm an application is exposed
- By default, Nginx exposes applications on port 80
- confirm exposed ports
- Delete the Pod
- Review the Pod spec
- Have a look at the Kubernetes API to determine when pods were introduced
Not all images expose their applications on port 80. Kubernetes doesn’t have a native way to check ports exposed on running container, however, you can connect a shell to a Pod with kubectl exec and try one of netstat -tulpn or ss -tulpn in the container, if installed, to show open ports.
lab5.1 solution
# host terminal
kubectl run mypod --image=nginx:alpine
kubectl get pods
kubectl describe pods mypod | less
kubectl get pods -o name
kubectl exec -it mypod -- sh
# container terminal
curl localhost # or curl localhost:80, can omit since 80 is the default
netstat -tulpn
ss -tulpn
exit
# host terminal
kubectl delete pods mypod
kubectl explain pod.spec
kubectl api-resources # pods were introduced in v1 - the first version of kubernetes
Pod manifest file
Example of a Pod manifest file with a busybox image and mounted empty-directory volume.
apiVersion: v1 # api version
kind: Pod # type of resource, pod, deployment, configmap, etc
metadata:
name: box # metadata information, including labels, namespace, etc
spec:
volumes: # create an empty-directory volume
- name: varlog
emptyDir: {}
containers:
- name: box
image: busybox:1.28
volumeMounts: # mount created volume
- name: varlog
mountPath: /var/log
Volumes are covered in more detail in Chapter 10 - Storage. For now it will suffice to know how to create and mount an empty-directory volume
# view description of a Kubernetes Object with `kubectl explain <object>[.field]`, see `kubectl explain --help`
kubectl explain pod
kubectl explain pod.metadata # or `pod.spec`, `pod.status` etc
# include nested fields with `--recursive`
kubectl explain --recursive pod.spec | less
# perform actions on a resource with a YAML file
kubectl {create|apply|replace|delete} -f pod.yaml
# generate YAML file of a specific command with `--dry-run`
kubectl run mynginx --image=nginx -o yaml --dry-run=client > pod.yaml
Object fields are case sensitive, always generate manifest files to avoid typos
kubectl apply creates a new resource, or updates existing if previously created by kubectl apply
Valid reasons for multi-container Pods
Always create single container Pods! However, some special scenarios require a multi-container Pod pattern:
Lab 5.2. Managing Pods with YAML file
In the official k8s docs, you will often find example code with a URL, e.g. pods/commands.yaml. The file can be downloaded by appending https://k8s.io/examples to the URL, thus: https://k8s.io/examples/pods/commands.yaml
# download file `pods/commands.yaml`
wget https://k8s.io/examples/pods/commands.yaml
# save downloaded file with a new name `comm.yaml`
wget https://k8s.io/examples/pods/commands.yaml -O comm.yaml
# hide output while downloading
wget -q https://k8s.io/examples/pods/commands.yaml
# view contents of a downloaded file without saving
wget -O- https://k8s.io/examples/pods/commands.yaml
# view contents quietly without saving
wget -qO- https://k8s.io/examples/pods/commands.yaml
- Generate a YAML file of a
busybox Pod that runs the command sleep 60, see create Pod with command and args docs
- Apply the YAML file.
- List created resources
- View details of the Pod
- Delete the Pod
lab5.2 solution
kubectl run mypod --image=busybox --dry-run=client -o yaml --command -- sleep 60 > lab5-2.yaml
kubectl apply -f lab5-2.yaml
kubectl get pods
kubectl describe pods mypod | less
kubectl delete -f lab5-2.yaml
Some images, like busybox, do not remain in running state by default. An extra command is required, e.g. sleep 60, to keep containers using these images in running state for as long as you need. In the CKAD exam, make sure your Pods remain in running states unless stated otherwise
Lab 5.3. Init Containers
Note that the main container will only be started after the init container enters STATUS=completed
# view logs of pod `mypod`
kubectl logs mypod
# view logs of specific container `mypod-container-1` in pod `mypod`
kubectl logs mypod -c mypod-container-1
- Create a Pod that logs
App is running! to STDOUT
- use
busybox:1.28 image
- the application should
Never restart
- the application should use a Init Container to wait for 60secs before starting
- the Init Container should log
App is initialising... to STDOUT
- see init container docs.
- List created resources and note Pod
STATUS
- View the logs of the main container
- View the logs of the init container
- View more details of the Pod and note the
State of both containers.
- List created resources and confirm Pod
STATUS
- Delete Pod
lab5.3 solution
# partially generate pod manifest
kubectl run myapp --image=busybox:1.28 --restart=Never --dry-run=client -o yaml --command -- sh -c "echo App is running!" > lab5-3.yaml
# edit lab5-3.yaml to add init container spec
apiVersion: v1
kind: Pod
metadata:
labels:
run: myapp
name: myapp
spec:
containers:
- name: myapp
image: busybox:1.28
command: ["sh", "-c", "echo App is running!"]
initContainers:
- name: myapp-init
image: busybox:1.28
command: ["sh", "-c", 'echo "App is initialising..." && sleep 60']
restartPolicy: Never
kubectl apply -f lab5-3.yaml
kubectl get pods
kubectl logs myapp # not created until after 60secs
kubectl logs myapp -c myapp-init
kubectl describe -f lab5-3.yaml | less
kubectl get pods
kubectl delete -f lab5-3.yaml
Lab 5.4. Multi-container Pod
- Create a Pod with 2 containers and a volumne shared by both containers, see multi-container docs.
- List created resources
- View details of the Pod
- Delete the Pod
lab5.4 solution
# lab5-4.yaml
apiVersion: v1
kind: Pod
metadata:
name: myapp
spec:
containers:
- name: myapp-1
image: busybox:1.28
volumeMounts:
- name: logs
mountPath: /var/log
- name: myapp-2
image: busybox:1.28
volumeMounts:
- name: logs
mountPath: /var/log
volumes:
- name: logs
emptyDir: {}
kubectl apply -f lab5-4.yaml
kubectl get pods
kubectl describe pods myapp | less
kubectl logs myapp -c myapp-1
kubectl logs myapp -c myapp-2
kubectl delete -f lab5-4.yaml
Always create single container Pods!
Lab 5.5. Sidecar Containers
Remember you can prepend https://k8s.io/examples/ to any example manifest names from the official docs for direct download of the YAML file
- Create a
busybox Pod that logs date to a file every second
- expose the logs with a sidecar container’s STDOUT to prevent direct access to the main application
- see example sidecar container manifest
https://k8s.io/examples/admin/logging/two-files-counter-pod-streaming-sidecar.yaml
- List created resources
- View details of the Pod
- View the logs of the main container
- View the logs of the sidecar container
- Delete created resources
lab5.5 solution
# lab5-5.yaml
apiVersion: v1
kind: Pod
metadata:
name: myapp
spec:
containers:
- name: myapp
image: busybox:1.28
args:
- /bin/sh
- -c
- >
while true;
do
echo $(date) >> /var/log/date.log;
sleep 1;
done
volumeMounts:
- name: logs
mountPath: /var/log
- name: myapp-logs
image: busybox:1.28
args: [/bin/sh, -c, "tail -F /var/log/date.log"]
volumeMounts:
- name: logs
mountPath: /var/log
volumes:
- name: logs
emptyDir: {}
kubectl apply -f lab5-5.yaml
kubectl get pods
kubectl describe pods myapp | less
kubectl logs myapp -c myapp
kubectl logs myapp -c myapp-logs
kubectl delete -f lab5-5.yaml
Using namespaces
Namespaces are a way to divide/isolate cluster resources between multiple users. Names of resources need to be unique within a Namespace, but not across namespaces.
Not all Kubernetes resources are in a Namespace and Namespace-based scoping is only applicable for namespaced objects.
Namespaces should be used sensibly, you can read more about understanding the motivation for using namespaces
# create namespace called `myns`, see `kubectl create namespace -h`
kubectl create namespace myns
# run a pod in the `myns` namespace with `-n myns`
kubectl run mypod --image=imageName -n myns
# view pods in the `myns` namespaces
kubectl get pods -n myns
# list pods in all namespaces with `--all-namespaces` or `-A`
kubectl get pods --all-namespaces
# list all resources in all namespaces
kubectl get all --all-namespaces
# view the current namespace in use for commands
kubectl config view --minify | grep namespace:
# set `myns` namespace to be the namespace used for subsequent commands
kubectl config set-context --current --namespace=myns
# view kubernetes api resources in a namespace
kubectl api-resources --namespaced=true
# view kubernetes api resources not in a namespace
kubectl api-resources --namespaced=false
# view the namespace object
kubectl explain namespace | less
# view the namespace object recursively
kubectl explain namespace --recursive | less
Lab 5.6 Namespaces
You can also follow the admin guide doc for namespaces
Remember you can connect a shell to a Pod with kubectl exec and try one of netstat -tulpn or ss -tulpn in the container, if installed, to show open ports.
- Create a Namespace
myns
- Create a webserver Pod in the
myns Namespace
- Review created resources and confirm
myns Namespace is assigned to the Pod
- Delete resources created
- Review the
NAMESPACED column of the Kubernetes API resources
- Review the Namespace object and the Namespace spec
lab5.6 solution
kubectl create ns myns --dry-run=client -o yaml > lab5-6.yaml
echo --- >> lab5-6.yaml
kubectl run mypod --image=httpd:alpine -n myns --dry-run=client -o yaml >> lab5-6.yaml
kubectl apply -f lab5-6.yaml
kubectl get pods
kubectl describe -f lab5-6.yaml | less
kubectl delete -f lab5-6.yaml
kubectl api-resources | less
kubectl explain namespace | less
kubectl explain namespace --recursive | less
kubectl explain namespace.spec | less
Remember that namespaced resources are not visible by default unless the namespace is specified
💡 kubectl get pods - only shows resources in the default namespace
💡 kubectl get pods -n mynamespace - shows resources in the mynamespace namespace
Task - Pods
Imagine a student in the CKAD Bootcamp training reached out to you for assistance to finish their homework. Their task was to create a webserver with a sidecar container for logging in the cow namespace. Find this Pod, which could be located in one of the Namespaces ape, cow or fox, and ensure it is configured as required.
At the end of your task, copy the log file used by the logging container to directory /home/$USER/ckad-tasks/pods/
- Command to setup environment:
printf '\nlab: environment setup in progress...\n'; echo '{"apiVersion":"v1","items":[{"kind":"Namespace","apiVersion":"v1","metadata":{"name":"fox"}},{"kind":"Namespace","apiVersion":"v1","metadata":{"name":"ape"}},{"kind":"Namespace","apiVersion":"v1","metadata":{"name":"cow"}},{"apiVersion":"v1","kind":"Pod","metadata":{"labels":{"run":"box"},"name":"box","namespace":"ape"},"spec":{"containers":[{"args":["sleep","3600"],"image":"busybox","name":"box"}],"dnsPolicy":"ClusterFirst","restartPolicy":"Always"}},{"apiVersion":"v1","kind":"Pod","metadata":{"labels":{"run":"for-testing"},"name":"for-testing","namespace":"fox"},"spec":{"containers":[{"args":["sleep","3600"],"image":"busybox","name":"for-testing"}],"dnsPolicy":"ClusterFirst","restartPolicy":"Always"}},{"apiVersion":"v1","kind":"Pod","metadata":{"labels":{"run":"webserver"},"name":"webserver","namespace":"fox"},"spec":{"containers":[{"name":"server","image":"ngnx:1.20-alpine","volumeMounts":[{"name":"serverlog","mountPath":"/usr/share/nginx/html"}]},{"name":"logger","image":"busybox:1.28","args":["/bin/sh","-c","while true; do echo $(date) >> /usr/share/nginx/html/1.log;\n sleep 30;\ndone\n"],"volumeMounts":[{"name":"serverlog","mountPath":"/usr/share/nginx/html"}]}],"volumes":[{"name":"serverlog","emptyDir":{}}]}}],"metadata":{"resourceVersion":""},"kind":"List"}' | kubectl apply -f - >/dev/null; echo 'lab: environment setup complete!'
- Command to destroy environment:
kubectl delete ns ape cow fox
hints
hint 1
Did you search for Pods in specific namespaces, e.g. kubectl get pod -n ape?
hint 2
Did you review the Pod error message under STATUS column of kubectl get po command? You can re
README 内容过长,已截取前 64 KB。完整内容请前往 GitHub 仓库查看。
评论