Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
The Kubernetes Workshop

You're reading from   The Kubernetes Workshop Learn how to build and run highly scalable workloads on Kubernetes

Arrow left icon
Product type Paperback
Published in Sep 2020
Publisher Packt
ISBN-13 9781838820756
Length 780 pages
Edition 1st Edition
Arrow right icon
Authors (6):
Arrow left icon
Zachary Arnold Zachary Arnold
Author Profile Icon Zachary Arnold
Zachary Arnold
Mohammed Abu Taleb Mohammed Abu Taleb
Author Profile Icon Mohammed Abu Taleb
Mohammed Abu Taleb
Wei Huang Wei Huang
Author Profile Icon Wei Huang
Wei Huang
Sahil Dua Sahil Dua
Author Profile Icon Sahil Dua
Sahil Dua
Mélony Qin Mélony Qin
Author Profile Icon Mélony Qin
Mélony Qin
Faisal Masood Faisal Masood
Author Profile Icon Faisal Masood
Faisal Masood
+2 more Show less
Arrow right icon
View More author details
Toc

Table of Contents (20) Chapters Close

Preface
1. Introduction to Kubernetes and Containers 2. An Overview of Kubernetes FREE CHAPTER 3. kubectl – Kubernetes Command Center 4. How to Communicate with Kubernetes (API Server) 5. Pods 6. Labels and Annotations 7. Kubernetes Controllers 8. Service Discovery 9. Storing and Reading Data on Disk 10. ConfigMaps and Secrets 11. Build Your Own HA Cluster 12. Your Application and HA 13. Runtime and Network Security in Kubernetes 14. Running Stateful Components in Kubernetes 15. Monitoring and Autoscaling in Kubernetes 16. Kubernetes Admission Controllers 17. Advanced Scheduling in Kubernetes 18. Upgrading Your Cluster without Downtime 19. Custom Resource Definitions in Kubernetes

How Our Custom Resources Are Defined

To come up with a solution for Example Use Case 3 in the previous section, we have decided that our CRD will define two fields, as mentioned in the preceding example. To accomplish this, our CR object will look as follows.

apiVersion: "controllers.kube.book.au/v1"
kind: PodLifecycleConfig
metadata:
  name: demo-pod-lifecycle
spec:
  namespaceName: crddemo
  podLiveForThisMinutes: 1

The preceding specification defines our target object. As you can see, it looks just like normal Kubernetes objects, but the specifications (the spec section) are defined as per our requirements. Let's dig a bit deeper into the details.

apiVersion

This is the field required by Kubernetes to group objects. Note that we put the version (v1) as part of the group key. This grouping technique helps us keep multiple versions of our object. Consider whether you want to add a new property without affecting existing users...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime