Instal and Configure of Skaffold on Debian 12 Linux

Instal and Configure of Skaffold on Debian 12 Linux

31.05.2024
Author: HostZealot Team
2 min.
122

Skaffold is a rather popular tool that is needed for continuous development. With this container-based tool, it is possible to manage deploying, developing, and pushing the app and also creating pieces for CD/CI pipelines. Scaffold can deliver your app to a Kubernetes cluster, cloud project, or docker environment.

The workflow is easily automated due to the Scaffold management that functions on the Kubernetes clusters. Generally speaking, the developers can greatly simplify their working process with the usage of Skaffold. This tool functions in the background while the developers are coding and the program updates everything automatically without any additional instructions.  

Explore Skaffold's Capabilities

Skaffold is really helpful for simplifying a variety of processes, and some of them are:

  • Creation of Docker images and labeling of Kubernetes manifest images.
  • Debugging of the app.
  • Quick change of Kubernetes cluster after the modifications in the source code.
  • Toolset for continuous delivery and integration.

Here are a couple of Skaffold features that this tool was designed with:

  • CD/CI building blocks (delete/test/build/apply, and other options).
  • Pipeline options (test/ deploy/build/delete/apply/render).
  • Pipeline is managed to automatically create, launch, push app, and recognize changes in the source code.
  • The value of the additional components, such as deploy/build, local configuration, and environment variables, are also crucial.
  • This tool is considered to be a really lightweight variant that can be applied in external CI/CD components and Dev.
  • Skaffold has a method for logging and port-forwarding.

Necessary Conditions for Skaffold Installation

Prior to the installation process, you should understand that you should have the following tools:

  • Kubectl
  • Docker
  • Skaffold
  • Minikube

Here in this article, we will share our practical experience and show you the installation and configuration of Skaffold on a Linux system (in this case, we will use Debian).

Instal Skaffold

The installation process of Skaffold is really simple and all you need to do is open the terminal and fill in the following line:

curl -Lo skaffold https://storage.googleapis.com/skaffold/builds/latest/skaffold-linux-arm64 && \
sudo install skaffold /usr/local/bin/

When you have finished this initial step, let’s proceed to the following one that is equally important for the full functionality.

Docker Installation Instructions

Follow the next step-by-step procedure for the proper Docker installation on a Linux system:

- Update the packages by entering the following command in the terminal.

sudo apt update

- Installation of the needed packages.

sudo apt install apt-transport-https ca-certificates curl software-properties-common

- Add Docker repository.

curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

- Update the packages.

sudo apt update

- Installation of the Docker.

sudo apt install docker-ce docker-ce-cli containerd.io

- Start Docker.

sudo systemctl start docker
sudo systemctl enable docker

Installation of Minikube and kubectl

Kubectl is important for the management of Kubernetes clusters. For the installation of the latest release use the following command:

curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" 
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl

To install minikube use the following:

wget https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 -O minikube

Establish Kubernetes Cluster with minikube

To start establishing Kubernetes cluster use the following command:

minikube start --profile custom
skaffold config set --global local-cluster true
eval $(minikube -p custom docker-env)

The output of the above-mentioned command will contain the info about Debian and minikube versions and some tips and descriptions of the current processes.

Deploying Application on Kubernetes

To simplify the understanding of this process, let’s use the Petclinic Spring Boot app as a sample. To test and deploy the app on Kubernetes copy the app from:

git clone https://github.com/spring-projects/spring-petclinic.git

The following step will be needed to change the directory:

cd spring-petclinic

Create a Docker file that will include the source code and container image. In the root directory of an app, make such a file and add the following content.

FROM maven:3.8.4-openjdk-17-slim AS build
WORKDIR /home/app
COPY src /home/app/src
COPY pom.xml /home/app
RUN mvn -f /home/app/pom.xml clean package
FROM openjdk:17-jdk-slim
WORKDIR /app
COPY --from=build /home/app/target/*.jar /usr/local/lib/petclinic.jar

Then use the following line:

docker build -t spring-petclinic-builder

Test if the container was created with:

docker run -p 8080:8080 spring-petclinic-builder

To review whether the program is functioning, you can open the browser and enter the webpage.

Now when you have reviewed and tested the app, we will proceed with the next process that relates to the running of the app on Kubernetes. Use such commands as:

skaffold init --generate-manifests

For the accessing of the app in Kubernetes, you should open the tunnel with:

$ minikube tunnel -p custom

With the usage of run, you can launch/build the app in Kubernetes.

skaffold run –tail

For the automatic deployment and monitoring of the modifications in the source code, utilize the next line:

skaffold dev

To Sum up

This guide is important for all the users who need professional information about the installation, configuration, and further utilization of Skaffold on the Linux system. The process of using this tool is so simple, that all you need to do is follow the guidance. If you want to get additional recommendations about the usage of Skaffold, you can find the docs on the official website. Don’t hesitate and start testing this awesome tool right now, you can automate lots of processes in your coding experience!    

Related Articles