Go for DevOps: Learn how to use the Go language to automate servers, the cloud, Kubernetes, GitHub, Packer, and Terraform (Paperback)

Doak, John, Justice, David



Achieve reliable release automation and get zero troublesome notifications on your release day

Key Features

• Develop the skills to build command-line tools to control thousands of nodes
• Use Go to create Terraform providers and GitHub actions and extend Kubernetes
• Gain the knowledge to build DevOps workflows that are understandable, scalable, and safe

Book Description

Go is the go-to language for DevOps libraries and services, and without it, achieving fast and safe automation is a challenge. With the help of Go for DevOps, you'll learn how to deliver services with ease and safety, becoming a better DevOps engineer in the process.

Some of the key things this book will teach you are how to write Go software to automate configuration management, update remote machines, author custom automation in GitHub Actions, and interact with Kubernetes. As you advance through the chapters, you'll explore how to automate the cloud using software development kits (SDKs), extend HashiCorp's Terraform and Packer using Go, develop your own DevOps services with gRPC and REST, design system agents, and build robust workflow systems.

By the end of this Go for DevOps book, you'll understand how to apply development principles to automate operations and provide operational insights using Go, which will allow you to react quickly to resolve system failures before your customers realize something has gone wrong.

What you will learn

• Understand the basic structure of the Go language to begin your DevOps journey
• Interact with filesystems to read or stream data
• Communicate with remote services via REST and gRPC
• Explore writing tools that can be used in the DevOps environment
• Develop command-line operational software in Go
• Work with popular frameworks to deploy production software
• Create GitHub actions that streamline your CI/CD process
• Write a ChatOps application with Slack to simplify production visibility

Who this book is for

This book is for Ops and DevOps engineers who would like to use Go to develop their own DevOps tooling or integrate custom features with DevOps tools such as Kubernetes, GitHub Actions, HashiCorp Packer, and Terraform. Experience with some type of programming language, but not necessarily Go, is necessary to get started with this book.




- 學習構建命令行工具以控制數千個節點的技能
- 使用 Go 創建 Terraform 提供者和 GitHub actions,並擴展 Kubernetes
- 獲得構建可理解、可擴展和安全的 DevOps 工作流程的知識


Go 是 DevOps 函式庫和服務的首選語言,沒有它,實現快速且安全的自動化是一個挑戰。通過《Go for DevOps》,您將學習如何輕鬆且安全地提供服務,並在此過程中成為更好的 DevOps 工程師。

本書將教您如何使用 Go 編寫軟件來自動化配置管理、更新遠程機器、在 GitHub Actions 中編寫自定義自動化以及與 Kubernetes 進行交互。隨著章節的進展,您將探索如何使用軟件開發工具包(SDK)自動化雲端、使用 Go 擴展 HashiCorp 的 Terraform 和 Packer、使用 gRPC 和 REST 開發自己的 DevOps 服務、設計系統代理和構建強大的工作流系統。

通過閱讀《Go for DevOps》,您將了解如何應用開發原則來自動化操作並使用 Go 提供運營洞察,這將使您能夠在客戶意識到問題之前迅速解決系統故障。


- 了解 Go 語言的基本結構,開始您的 DevOps 之旅
- 與文件系統交互以讀取或流式傳輸數據
- 通過 REST 和 gRPC 與遠程服務進行通信
- 探索在 DevOps 環境中可用的工具編寫
- 使用 Go 開發命令行操作軟件
- 使用流行框架部署生產軟件
- 創建簡化 CI/CD 過程的 GitHub Actions
- 使用 Slack 編寫 ChatOps 應用程序,簡化生產可見性


本書適用於希望使用 Go 開發自己的 DevOps 工具或將自定義功能與 Kubernetes、GitHub Actions、HashiCorp Packer 和 Terraform 等 DevOps 工具集成的運維和 DevOps 工程師。開始閱讀本書需要具備某種類型的編程語言經驗,但不一定需要 Go 的經驗。


1. Go Language Basics
2. Go Language Essentials
3. Setting Up Your Environment
4. Filesystem Interactions
5. Using Common Data Formats
6. Interacting with Remote Data Sources
7. Writing Command-Line Tooling
8. Automating Command-Line Tasks
9. Observability with OpenTelemetry
10. Automating Workflows with GitHub Actions
11. Using ChatOps to Increase Efficiency
12. Creating Immutable Infrastructure Using Packer
13. Infrastructure as Code with Terraform
14. Deploying and Building Applications in Kubernetes
15. Programming the Cloud
16. Designing for Chaos


1. Go語言基礎
2. Go語言基本知識
3. 環境設置
4. 檔案系統互動
5. 使用常見的資料格式
6. 與遠端資料來源互動
7. 撰寫命令列工具
8. 自動化命令列任務
9. 使用OpenTelemetry進行可觀察性
10. 使用GitHub Actions自動化工作流程
11. 使用ChatOps提高效率
12. 使用Packer創建不可變基礎設施
13. 使用Terraform進行基礎設施即代碼
14. 在Kubernetes中部署和構建應用程式
15. 雲端程式設計
16. 設計以應對混亂情況