Skip to content

Instantly share code, notes, and snippets.

View iamabhishek-dubey's full-sized avatar
🎯
Focusing

Abhishek Dubey iamabhishek-dubey

🎯
Focusing
View GitHub Profile
---
apiVersion: opstreelabs.in/v1alpha1
kind: MongoDBCluster
metadata:
name: mongodb
spec:
clusterSize: 3
kubernetesConfig:
image: quay.io/opstree/mongo:v5.0
imagePullPolicy: IfNotPresent
job "iis-test" {
datacenters = ["dc1"]
type = "service"
group "iis-test" {
count = 1
restart {
attempts = 10
interval = "5m"
delay = "25s"

Lab Exercises for Cluster Architecture, Installation and Configuration

Exercise 1 - RBAC

A third party application requires access to describe ingress objects that reside in a namespace called rbac. Perform the following:

  1. Create a namespace called rbac
  2. Create a service account called job-inspector for the rbac namespace
  3. Create a role that ha rules to get and list job objects
  4. Create a rolebinding that binds the service account job-inspector to the role created in step 3

General Advice

Imperative vs Declarative

The Lab guide, where feasible will presnt both imperative and declarative answers to address a question. Outside the exam, we should opreate in a Declarative manner. During the exam, however, time is an expensive commodity. Therefore, if you can, try and be as imperative as possible to save time.

Use the documentation

At time of writing, https://kubernetes.io/docs/, https://github.com/kubernetes/ and https://kubernetes.io/blog/ are permitted to be used during the exam as per the current guidelines. If you need to get boiletplate YAML manifests to address an exam question, feel free to get them from here. The key is to know what to search for.

K8s | Request and Limits Lab

In this lab we will migrate our MS to a dev namespace so that we can limit them in terms of cluster resources usage:

  • Create a namespace dev
  • Put resource limit on your Namespace
    • CPU: 500 - 1000 millicore
    • Memory: 500 - 1500 MB
    • Restrict this namespace to not have more than 10 pods
  • Deploy your MS
    • MySQL: 200 millicore, (100-500) MB memory

K8s | Probes Lab

Problem Statement:-

In this lab, we will use liveness and readiness probes to ensure that k8s to handle the availability of microservices. Implement readiness & liveness for all of our microservice:

  • Salary, Employee, Attendance, Gateway
  • Identify the difference in deployment with and without readiness probe

By the end of this lab, you will have a clear understanding of probes and how important a role they play in a fully functional app.