Effortless Cloud-Native App Development Using Skaffold - Ashish Choudhary - E-Book

Effortless Cloud-Native App Development Using Skaffold E-Book

Ashish Choudhary

0,0
27,59 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.
Mehr erfahren.
Beschreibung

Kubernetes has become the de facto standard for container orchestration, drastically improving how we deploy and manage cloud-native apps. Although it has simplified the lives of support professionals, we cannot say the same for developers who need to be equipped with better tools to increase productivity. An automated workflow that solves a wide variety of problems that every developer faces can make all the difference!
Enter Skaffold – a command-line tool that automates the build, push, and deploy steps for Kubernetes applications.
This book is divided into three parts, starting with common challenges encountered by developers in building apps with Kubernetes. The second part covers Skaffold features, its architecture, supported container image builders, and more. In the last part, you'll focus on practical implementation, learning how to deploy Spring Boot apps to cloud platforms such as Google Cloud Platform (GCP) using Skaffold. You'll also create CI/CD pipelines for your cloud-native apps with Skaffold. Although the examples covered in this book are written in Java and Spring Boot, the techniques can be applied to apps built using other technologies too.
By the end of this Skaffold book, you'll develop skills that will help accelerate your inner development loop and be able to build and deploy your apps to the Kubernetes cluster with Skaffold.

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB
MOBI

Seitenzahl: 223

Veröffentlichungsjahr: 2021

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Effortless Cloud-Native App Development Using Skaffold

Simplify the development and deployment of cloud-native Spring Boot applications on Kubernetes with Skaffold

Ashish Choudhary

BIRMINGHAM—MUMBAI

Effortless Cloud-Native App Development Using Skaffold

Copyright © 2021 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

Group Product Manager: Alok Dhuri

Publishing Product Manager: Shweta Bairoliya

Senior Editor: Nitee Shetty

Content Development Editor: Tiksha Lad

Technical Editor: Maran Fernandes

Copy Editor: Safis Editing

Project Coordinator: Deeksha Thakkar

Proofreader: Safis Editing

Indexer: Subalakshmi Govindhan

Production Designer: Ponraj Dhandapani

First published: September 2021

Production reference: 1090921

Published by Packt Publishing Ltd.

Livery Place

35 Livery Street

Birmingham

B3 2PB, UK.

ISBN 978-1-80107-711-8

www.packt.com

Contributors

About the author

Ashish Choudhary is a software engineer and has over 10 years of experience in the IT industry. He has experience in designing, developing, and deploying web applications. His technical expertise includes Java, Spring Boot, Docker, Kubernetes, IMDG, distributed systems, microservices, DevOps, the cloud, and the general software development life cycle. He is an active blogger and technical writer. He has delivered talks to some renowned conferences such as GitHub Satellite India and Fosdem. He is also a strong advocate of open source technologies. He has been contributing to various open source projects for quite some time. Ashish believes in continuous learning and knowledge sharing.

This book would not have been completed without the patience and motivation of my lovely wife, Shefali, and my little son Ayansh.

About the reviewer

Sirinat Paphatsirinatthi is the director and co-founder of KubeOps Skills. He is interested in cloud-native technology and DevOps culture building for organizations using SRE recommended practices from Google. Currently, he is a speaker disseminating knowledge to the top leading financial services in Thailand and the Kubernetes/Docker Thailand User Group. He is also the community leader of Cloud Native Bangkok.

Table of Contents

Preface

Section 1: The Kubernetes Nightmare – Skaffold to the Rescue

Chapter 1: Code, Build, Test, and Repeat – The Application Development Inner Loop

Technical requirements

Understanding the application development inner loop

Inner versus outer development loops

Why not use CI/CD?

Exploring the traditional application development inner loop

Spring Boot Developer Tools

JRebel

Checking out the container-native application development inner loop

Summary

Further reading

Chapter 2: Developing Cloud-Native Applications with Kubernetes – A Developer's Nightmare

Technical requirements

Poor developer experience

Understanding the cloud-native application development workflow

Developers want simplified workflows with Kubernetes

Developers are not Kubernetes experts

Summary

Further reading

Chapter 3: Skaffold — Easy-Peasy Cloud-Native Kubernetes Application Development

Technical requirements

What is Skaffold?

Building and deploying a Spring Boot application with Skaffold

Creating a Spring Boot application

Understanding the Skaffold configuration

Building and deploying the Spring Boot application

Summary

Further reading

Section 2: Getting Started with Skaffold

Chapter 4: Understanding Skaffold's Features and Architecture

Technical requirements

Understanding Skaffold's features

Demystifying Skaffold's architecture

Understanding the Skaffold workflow

Deciphering Skaffold's configuration with skaffold.yaml

Summary

References

Chapter 5: Installing Skaffold and Demystifying Its Pipeline Stages

Technical requirements

Installing Skaffold

Installing Skaffold on Linux

Installing Skaffold on macOS

Installing Skaffold on Windows

Installing Skaffold using Docker

Installing Skaffold using gcloud

Understanding common CLI commands

Understanding Skaffold pipeline stages

Init stage

Build stage

Tag stage

Test stage

Deploy stage

File sync

Log tailing

Port forwarding

Cleanup

Debugging with Skaffold

Summary

Further reading

Chapter 6: Working with Skaffold Container Image Builders and Deployers

Technical requirements

Creating a Reactive Spring Boot CRUD application

Working with Skaffold container image builders

Dockerfile

Jib

Bazel

Buildpacks

Custom script

kaniko

Google Cloud Build

Exploring Skaffold container image deployers

Helm

kubectl

Kustomize

Summary

Further reading

Section 3: Building and Deploying Cloud-Native Spring Boot Applications with Skaffold

Chapter 7: Building and Deploying a Spring Boot Application with the Cloud Code Plugin

Technical requirements

Introducing Google's Cloud Code plugin

Installing and working with the IntelliJ Cloud Code plugin

Creating a Spring Boot application

Containerizing and deploying a Spring Boot application using Cloud Code

Summary

Chapter 8: Deploying a Spring Boot Application to the Google Kubernetes Engine Using Skaffold

Technical requirements

Getting started with the Google Cloud Platform

Working with Google Cloud SDK and Cloud Shell

Downloading Cloud SDK on Linux

Downloading Cloud SDK on macOS

Setting up Cloud SDK

Setting up a Google Kubernetes Engine cluster

Creating a Kubernetes cluster using Google Cloud SDK

Creating a Kubernetes cluster using Google Console

Introducing the Google Kubernetes Engine Autopilot cluster

Creating an Autopilot cluster

Deploying a Spring Boot application to the GKE

Deploying from local to a remote GKE cluster using Skaffold

Deploying from Cloud Shell to a GKE cluster using Skaffold

Summary

Further reading

Chapter 9: Creating a Production-Ready CI/CD Pipeline with Skaffold

Technical requirements

Getting started with GitHub Actions

Creating a GitHub Actions workflow

Creating a CI/CD pipeline with GitHub Actions and Skaffold

Prerequisites

Implementing a GitOps workflow with Argo CD and Skaffold

What is GitOps, and what are its benefits?

What is Argo CD?

Continuous delivery with Argo CD and Skaffold on GKE

Summary

Further reading

Chapter 10: Exploring Skaffold Alternatives, Best Practices, and Pitfalls

Comparing Skaffold with other alternatives

Telepresence

Tilt.dev

OpenShift Do

Oketo

Garden

docker-compose

Applying Skaffold best practices

Avoiding Skaffold pitfalls

Future roadmap

Final thoughts

Summary

Why subscribe?

Other Books You May Enjoy

Preface

Tooling around Kubernetes has changed drastically over the years, given the hype around it. More and more developers are looking for tools that can help them get started quickly with Kubernetes. It also causes some confusion among developers: which tool they should use in order to spend less time configuring their local setup, or writing scripts to automate their inner dev loop workflow? Moreover, developers require better tools while working with Kubernetes because the focus should be on the task at hand, that is, coding, rather than agonizing about how and where they will deploy an application. Ideally, you would prefer a tool that provides extensibility to support various use cases.

This book will show you how to solve inner development loop intricacies in cloud-native applications by automating build, push, and deploy boilerplate using Skaffold.

Who this book is for

This book is for cloud-native application developers, software engineers working with Kubernetes, and DevOps professionals looking for a solution to simplify their inner development loop and improve their CI/CD pipeline for cloud-native applications. Beginner-level knowledge of Java, Docker, Kubernetes, and the containers ecosystem is required before taking on this book.

What this book covers

Chapter 1, Code, Build, Test, and Repeat - The Application Development Inner Loop, defines the inner loop of application development and its importance. It also compares the inner with the outer development loop, and covers the typical development workflows for a traditional monolith application and a container-native microservices application.

Chapter 2, Developing Cloud-Native Applications with Kubernetes – A Developer's Nightmare, explains the problems that developers face while developing cloud-native applications with Kubernetes.

Chapter 3, Skaffold – Easy-Peasy Cloud-Native Kubernetes Application Development, provides a high-level overview of Skaffold. We will also demonstrate Skaffold's basic features by building and deploying a Spring Boot application.

Chapter 4, Understanding Skaffold's Features and Architecture, explores Skaffold's features and internals by looking at its architecture, workflow, and configuration file, skaffold.yaml.

Chapter 5, Installing Skaffold and Demystifying Its Pipeline Stages, explains Skaffold installation and common CLI commands used in its different pipeline stages.

Chapter 6, Working with Skaffold Container Image Builders and Deployers, explains various tools used for building (Docker, Jib, kaniko, Buildpacks) and deploying (Helm, kubectl, kustomize) container images to Kubernetes with Skaffold.

Chapter 7, Building and Deploying a Spring Boot Application with the Cloud Code Plugin, introduces you to the Cloud Code plugin developed by Google. It explains how to build and deploy a Spring Boot application to a Kubernetes cluster using the Cloud Code plugin with an IDE such as IntelliJ.

Chapter 8, Deploying a Spring Boot Application to Google Kubernetes Engine Using Skaffold, explains how you can deploy a Spring Boot application to Google Kubernetes Engine, a managed Kubernetes service provided by Google Cloud Platform with Skaffold.

Chapter 9, Creating a Production-Ready CI/CD Pipeline with Skaffold, explains how you can create a production-ready continuous integration and deployment pipeline of a Spring Boot application using Skaffold and GitHub actions.

Chapter 10, Exploring Skaffold Alternatives, Best Practices, and Pitfalls, looks at Skaffold alternative tools such as Telepresence, and also covers Skaffold best practices and traps.

To get the most out of this book

If you are using the digital version of this book, we advise you to type the code yourself or access the code via the GitHub repository (link available in the next section). Doing so will help you avoid any potential errors related to the copying and pasting of code.

Download the example code files

You can download the example code files for this book from GitHub at https://github.com/PacktPublishing/Effortless-Cloud-Native-App-Development-Using-Skaffold. In case there's an update to the code, it will be updated on the existing GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Download the color images

We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here:

https://static.packt-cdn.com/downloads/9781801077118_ColorImages.pdf

Conventions used

There are a number of text conventions used throughout this book.

Code in text: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "Internally, Skaffold creates a tar file with changed files that match the sync rules we define in the skaffold.yaml file."

A block of code is set as follows:

profiles:

  - name: userDefinedPortForward

    portForward:

      - localPort: 9090

        port: 8080

        resourceName: reactive-web-app

        resourceType: deployment

Any command-line input or output is written as follows:

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

Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "Now that we have a working project, click the Run/Debug Configurations dropdown and select Edit Configurations."

Tips or important notes

Appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: If you have questions about any aspect of this book, mention the book title in the subject of your message and email us at [email protected].

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/support/errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.

Piracy: If you come across any illegal copies of our works in any form on the Internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.

Share Your Thoughts

Once you've read Effortless Cloud-Native App Development Using Skaffold, we'd love to hear your thoughts! Please click here to go straight to the Amazon review page for this book and share your feedback.

Your review is important to us and the tech community and will help us make sure we're delivering excellent quality content.

Section 1: The Kubernetes Nightmare – Skaffold to the Rescue

In this section, we will describe the pain and suffering of developing an application with Kubernetes. There are several manual touchpoints in developing a Kubernetes application locally, and it decreases the productivity of a developer. The focus should be on writing code and adding more features to the product rather than worrying about replicating infrastructure on your workstation to debug an issue or test a feature. Engineers at Google described this as an infinite loop of pain and suffering. We will introduce you to Skaffold and how it can help you automate the build, push, and deploy workflow for applications running on Kubernetes.

In this section, we have the following chapters:

Chapter 1, Code, Build, Test, and Repeat – The Application Development Inner LoopChapter 2, Developing Cloud-Native Applications with Kubernetes – A Developer's NightmareChapter 3, Skaffold – Easy-Peasy Cloud-Native Kubernetes Application Development