Microservices, Kubernetes Fundamentals, Panel Prep, Micro Services Re-Panel

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

C#: Statements

Block - consists of a list of statements written between the delimiters { } Declaration - used to declare local variables and constants Expression - used to evaluate expressions. include method invocations, object allocations, assignments, increment and decrement, and await Selection - used to select one of a number of possible statements based on some expression. Contains the if and switch statements. Iteration - used to execute repeatedly an embedded statement. Contains the while, do, for, and foreach Jump - used to transfer control. Contains the break, continue, goto, throw, return, and yield

Dependency Inversion Principle

Depend on abstractions, not concretions Keep modules/classes loosely coupled as much as possible. To do that, we need to make both of them dependent on abstractions instead of knowing each other.

Microservice architectural style

Developing a single application as a suite of smaller services. MSA's are built around business needs and each service (component) is independently deployable by fully automated deployment machinery.

Cluster IP

Exposes the service on a cluster-internal IP. All Pods included in that service will share that same internal IP, meaning we can treat all instances as a single app.

Node Port

Exposes the service on each Node's IP at a static port. A ________ is an open port on every node of your cluster. Kubernetes transparently routes incoming traffic on the _________ to your service, even if your application is running on a different node.

Database Anomalies

If a DB has inconsistent data it can incur anomalies. Update Anomaly - When items are not linked properly they may not all get updated correctly. Deletion Anomaly - When a record is deleted but linked parts are not deleted. Insertion Anomaly - When data is inserted into a record that does not exist or cannot be inserted without an unrelated data.

Control Plane

The control plane's components make global decisions about the cluster, as well as detecting and responding to cluster events Control plane components can be run on any machine in the cluster, but typically are all run on a single machine wit nothing else

Normal Forms

The key, the whole, key, and nothing but the key. 1st Normal Form: (1NF) * Each cell contains a single value * Each record is unique * Contains atomic values 2nd Normal Form: (2NF) * Be in 1NF * Moves duplicated data to related table 3rd Normal Form: (3NF) * Be in 2NF * All columns represent the key (All the data is relevant)

Kubernetes

_____________ is a production-grade, open-source infrastructure for the deployment, scaling, management, and composition of application containers across clusters of hosts.

Conway's Law

______________ is an aphorism in IT that posits the idea that "organizations which design systems are constrained to produce designs which are copies of the communication structures of these organizations."

Node components

• Kubelet • Kube-Proxy • Pods • Containers

Open/Closed Principle

A Module/Class should be open to expansion but closed to change. We need to design our module/class in such a way that the new functionality can be added only when new requirements are generated. We can use inheritance to do this.

Cluster

A __________ consists of worker machines (nodes), that run containerized applications.

.NET: Projects

A _____________ contains all files that are compiled into an executable, library, or website. • Those files can include source code, icons, images, data files, etc. • Also contains compiler settings and other configuration files that might be needed by various services or components that your program communicates with.

.NET: Solution

A _____________ is a container for one or more related projects along with build information, Visual Studio window settings, and any miscellaneous files that aren't associated with a particular project.

SQL: Transaction Isolation Levels

A transaction isolation level is determined by its permissiveness of: Dirty Read - When a transaction reads new, uncommitted data of another transaction. Non-Repeatable Read - When a transaction reads the same row twice and gets a different value each time. Phantom Read - When two identical queries are executed but the rows retrieved by the two are different.

C#: Modifers

Abstract - Class cannot be instantiated. Members are only permitted in abstract classes, only have implementation in derived class methods using override. Virtual - used to modify a method, property, indexer, or event declaration to allow it to be overridden in a derived class. Can not be used with the static, abstract, private, or override modifiers Sealed - Prevents inheritance, and methods from being overridden. Static - Class cannot be instantiated or extended, all It's members must be static. Members belongs to the class type itself rather than the specific object instance.

The four pillars of OOP

Abstraction Encapsulation Inheritance Polymorphism

C#: Delegates

Are used to pass methods as arguments to other methods Events are a special kind of multicast delegate that can only be invoked from within the class or struct where they are declared (the publisher class). If other classes or structs subscribe to the event, their event handler methods will be called when the publisher class raises the event.

C#: Collections

Array - Is a set size. Can be Single-Dimensional, Multidimensional or Jagged. List<T> - Dynamic sizing. Dictionary<TKey,TValue> - Dynamic sizing. A collection of key/value pairs. A key and its value must be added at the same time. SortedList<TKey,TValue> - Dynamic sizing. A collection of key/value pairs that are sorted by key based. Queue<T> - Dynamic sizing. FIFO Stack<T> - Dynamic sizing. LIFO

C#: Expressions

Constructed from operands and operators. • Operators are: +, -, *, /, new • Operands are what the operators act upon: literals, fields, Local variables, expressions • Precedence of the operators controls the order in which the individual operators are evaluated. Basically, PEMDAS.

Service Account & Token controllers

Create default accounts and API access tokens for new namespaces

SQL Languages Categories

DDL - Data Definition Language. Statements to define the structure of the DB. * Create * Alter * Drop DML - Data Manipulation Language. Used to retrieve, modify, add data to tables. * Insert * Delete * Update * Truncate DCL - Data Control Language. Used to control access * Grant * Revoke TCL - Transaction Control Language. Handles transactions. * Savepoint * Rollback * Commit

SQL: Isolation Levels

Define the degree to which a transaction must be isolated from other data modifications made by any other transaction.

Node

Each _____ contains the services necessary to run the Pods on it, which are managed by the control plane. A _____ may be a virtual or physical machine.

.NET: Assemblies

Form the fundamental units of deployment, version control, reuse, activation scoping, and security permissions for .NET-based applications. • Code that the CLR executes. Each ____________ can have only one entry point (Main). • Security boundary. An _______________ is the unit at which permissions are requested and granted. • Version boundary. All types and resources in the same _______________ are versioned as a unit. • Deployment unit. When an application starts, only the ___________________ that the application initially calls must be present. Other _______________ are retrieved on demand.

C#: Datatypes

In C# datatypes are divided into two fundamental categories * Value Types - primitive data types, such as char, int, as well as structs. These types directly contain their data. Stored on the Stack * Reference Types - Classes and other complex data types. These types contain a reference to a location in memory where the data is directly held. Stored in the Heap

C#: Methods

Instance Methods - Require an object be instantiated to be called - myClassInstance.doWork() Static Methods - Can be called without instantiating an object - myClassName.doWork()

C#: Override

Is required to extend or modify the abstract or virtual implementation of an inherited method, property, indexer, or event. MEMBERS • provides a new implementation of an inherited method • must have the same signature as the inherited method. • Both methods must be virtual, abstract, or ______. • You cannot use the static, or virtual modifiers to modify an _______ method.

container runtime

Is the software that is responsible for running containers. • Docker • containerd • CRI-O • Kubernetes CRI

Liskov Substitution Principle

More derived classes should implement all the methods and fields of their parent, you should be able to use any derived class instead of a parent class and it will behave in the same manner. Functions that use pointers of references to base classes must be able to use objects of derived classes without knowing it.

C#: Access Modifiers

Public - Access isn't limited Private - (Default) Only accessible inside the class its declared. Internal - Accessible only within the same assembly. Protected - Accessible only through derived classes. Protected Internal - Accessible within the same assembly, or though a derived class. Private Protected - Accessible by types derived from the containing class, but only within its containing assembly.

SQL: Transaction Isolation Levels

Read Uncommitted - Allows All! Read Committed - Allows Non Repeatable Read and Phantom Repeatable Read - Allows Phantom Snapshot - Allows None! Serializable - Allows None!

OOP: Polymorphism

_____________________ is when each derived class implements the same methods but in different ways. If a base class member is marked abstract, it must be defined in the derived class. Only virtual base class members may be overridden. Only derived class members using the override keyword may implement an alternative definition of the virtual base class member.

Controllers

• Node controller: • Replication controller: • Endpoints controller: • Service Account & Token controllers:

kubectl syntax

◦ kubectl [command] [TYPE] [NAME] [flags] [command] Specifies the operation to perform (create, get, describe, delete.) [type] Specifies the (case-insensitive) resource type. [name] Specifies the name of the resource (case-sensitive) If omitted, details for all resources are displayed. [flags] Specifies optional flags.

ReplicaSet

A _____________ purpose is to maintain a stable set of replica Pods running at any given time. A _____________ will dynamically drive the cluster back to the predetermined desired state via creation of new Pods It is recommended to use Deployments instead of directly using ________________

C#: Classes

A class is a data structure that combines state (fields) and actions (methods and other function members) in a single unit. Provides a template for instances of the class. A class declaration starts with a header that specifies • the attributes and modifiers of the class, • the name of the class, • the base class (if given), and • the interfaces implemented by the class.

Single Responsibility Principle

A class should have only a __________________________ (i.e. only one potential change in the software's specification should be able to affect the specification of the class)

Primary Key

A field (or group of fields) that uniquely identifies a given entity in a table. Must be unique within the table. Table can contain only one.

Foreign Key

A primary key of one table that appears as an attribute in another table and acts to provide a logical relationship between the two tables

RDBMS (Relational Database Management System)

A program that allows the creation and administration of relational databases. SQL Server, PostgreSQL, etc...

ACID

Atomicity - Database modifications must follow "All or nothing" rule. Consistency - Only valid data will be written the the DB. if a transaction violates a consistency rule the entire transaction is rolled back. Isolation - Multiple transactions occurring at once should not affect each other. Durability - Any transaction committed to the DB will not be lost (backups and transaction logs)

Pods

Basically the scheduling unit of K8 Consists of one or more containers * When more than one, the containers are dependent Each Pod has a unique IP address inside the cluster

C#: Program Structure

C# programs consist of one or more source files. • Programs declare namespaces. • Namespaces contain types (classes/interfaces). • Types contain members (Fields, methods, properties, events)

When is MSA Appropriate?

Don't even consider microservices unless you have a system that's too complex to manage as a monolith.

Replication controller

Maintains the correct number of pods for every replication controller object in the system.

Managed vs. Unmanaged Code

Managed: is managed by the Common Language Runtime (CLR) at runtime. • The CLR provides memory management (GC), security boundaries, type safety, etc. • is written in a high-level language that can be run on top of .NET. • Code is compiled into Intermediate Language (IL [MISL, CIL]) code, which the CLR compiles and executes. Unmanaged: Code that runs outside the CLR ◦ COM components, ◦ ActiveX interfaces, ◦ Windows API functions.

Interface Segregation Principle

Many client-specific interfaces are better than one general purpose interface Each interface should have a specific purpose/responsibility. A class/client shouldn't be forced to implement an interface when the class doesn't share the interfaces purpose.

C#: Garbage Collection

Marking Phase (List of Live objects created) Relocation Phase (References for list of live objects created) Compacting Phase (Dead objects released & live objects compacted & moved) Generation 0 - Newly created objects are contained here. Generation 1 - Short-Lived objects, this serves as a buffer between G0 and G2 Generation 2 - Long-Lived objects

C#: Method Signature

Methods are declared in a class or struct by specifying a ______________ that contains: • (optional) access level • (optional) modifiers • Return value • Method name • Method parameters

Node controller

Notices and responds when nodes go down.

Endpoints controller

Populates the Endpoints object (joins Services & Pods)

Relational Database Constraints

Primary Key: Foreign Key: Unique Key: A column that much have a unique value (not the PK or FK) NOT NULL: The column must have a value Check: The values must meet a certain criteria. Default: Inserts a default value into the column if no value is supplied.

SQL (Structured Query Language)

Programming language used to communicate with relational databases. Allows access, describe, define, and manipulation operations.

C#: Namespaces

Provide a hierarchical means of organizing C# programs and libraries. A way to avoid naming conflicts.

Minikube CLI

Provides basic bootstrapping operations for working with your cluster, including start, stop, status, and delete.

SQL: Functions

Scalar - Takes in one or more parameters and returns a single value. Aggregate - Takes in a tabular value (column) and returns a single value. Table Valued - Takes in a table and returns a table

SOLID Principles

Single Responsibility Open/Closed Liskov Substitution Interface Segregation Dependency Inversion

Control Plane

The _________ _______ manages the worker nodes and the Pods in the cluster. The _________ _______ usually operates across multiple computers and a cluster usually runs multiple nodes. This provides fault tolerance and high availability.

OOP: Abstraction

The process of showing only essential/necessary features of an entity/object to the outside world and hide the other irrelevant information. _____________ is the process by which a developer separates the relevant data from the irrelevant details in order to simplify use.

(Worker) Nodes

The worker ____________ host the Pods that are the components of the application workload.

Ingress Resource

Traffic routing is controlled by rules defined on the _____________________. An ____________________ is (usually) a YAML file defining the rules for data accessing structures in a cluster.

C#: Boxing/Unboxing

Underlies the C# UTS in which a value of any type can be treated as an object. Boxing - When any value type is cast to an object. The value is wrapped to give it reference type behavior. Unboxing - Is an explicit conversion from the type object to a value type or from an interface type to a value type that implements the interface.

C#: Exceptions

Usage Errors - An error in program logic that should be addressed not through exception handling but by modifying the faulty code. Program Errors - a run-time error that cannot necessarily be avoided by writing bug-free code. System Failures - a run-time error that cannot be handled programmatically in a meaningful way When an exception is thrown by a method far down the call stack, the CLR will unwind the stack, looking for the correct catch.

OOP: Inheritance

_____________ is used to express an "is a" relationship between a base class and one or more derived classes, where the derived class 'is a' specialized version of the base class. Creating a new class from an existing class template. A class (subclass) acquires the properties and behavior of a 'base' ('super') class. The class that Inherits the members of the 'base' class is called the 'derived' class.

OOP: Encapsulation

_______________ the restricting of direct access to abstracted data. Wrapping data and member functions (Methods) together into a single unit (class). _______________ automatically achieves the concept of data hiding. This provides security to data by making variables private and allowing public methods access to the private variables.

Database Normalization

______________________ is the process of structuring a relational database in accordance with a series of normal forms in order to reduce data redundancy and improve data integrity. Third Normal Form is generally accepted.

Horizontal Pod Autoscaler

an API resource in the Kubernetes autoscaling API group which automatically scales the number of pods in a replication controller, deployment, replica set or stateful set based on observed CPU utilization.

Common Language Specification (CLS)

defines a set of features that are needed by many common applications. It also defines a set of rules and restrictions that every language must follow which runs under the .NET framework.

Common Language Infrastructure (CLI)

enables an application program written in any of several commonly-used programming languages to be run on any operating system using a common runtime program provides a virtual execution environment comparable to the one provided by Sun Microsystems for Java programs.

Common Intermediate Language (CIL)

formerly called Microsoft Intermediate Language (MSIL) is the intermediate language binary instruction set defined within the (CLI).

Common Language Runtime (CLR)

is a managed execution environment that is part of Microsoft's .NET framework. manages the execution of programs written in supported languages. transforms source code into a form of bytecode known as CIL (Common Intermediate Language).

Virtual Execution System (VES)

is a run-time system of a Common Language Infrastructure (CLI) which provides an environment for executing managed code The Common Language Runtime (CLR) is the .NET Framework's implementation

Ingress

refers to the right to enter a property. • Can be configured to give Services externally-reachable URLs, load balance traffic, terminate SSL/TLS, and offer name based virtual hosting. • It exposes HTTP(S) routes from outside the cluster to services within the cluster.

Kube-manager-controller

runs the controller processes.

Common Type System (CTS)

used by the CLR to enforce strict type-and-code-verification 1. describes all data types and all related constructs which are supported by the ___ 2. details how they must be represented in the .NET metadata format 3. specifies how entities can interact with each other This means that managed code can consume other managed types and instances, while strictly enforcing type fidelity and type safety.

kube-scheduler

watches for new Pods and assigns a node to them to run on based on predetermined requirements like: • hardware constraints • affinity/anti-affinity specifications • deadlines • and many more.

Node Structure

• A container represents your containerized application. • The container is placed into a Pod. • A Pod runs on a Node. • One or more Nodes make up a Cluster. • The Cluster is your Kubernetes Workload.

MiniKube

• A lightweight Kubernetes implementation that creates a VM on your local machine and deploys a simple cluster containing only one node. • Is available for Linux, macOS, and Windows systems.

kube-proxy

• A network proxy that runs on each node in your cluster. • Provides a way to group pods under a common access policy • Creates a virtual IP which clients can access, and which is transparently proxied to the pods in a Service. • The core networking component • Kube-proxy programs IpTables rules to trap access to service IPs

Kubernetes Master (Node) Components

• API Server • Scheduler • Control Manager • etcd

Things that go well with MSA

• Agile • DevOps, CI/CD • Containers/Docker • Orchestration/Kubernetes • Automated testing • REST

Kubelet

• An agent runs on each node in the cluster. • It is the primary implementer of the Pod and Node APIs • Uses PodSpecs to verify that containers described are running in the Pods. • Doesn't manage containers which were not created by Kubernetes

Basic characteristics of MSA

• Application divided into components (services). • Avoids Conway's Law. • Products, not projects • Developers are responsible for the service for its entire lifetime. • Smart endpoints and dumb pipes

Basic characteristics of Microservices Components

• Each service implements one business capability. • Services are developed, deployed, and scaled independently. • Services control their own logic. • Services manage/persist their own data • Each services is replaceable and upgradable. • Services communicate with RPC's

API Server

• Exposes the Kubernetes API. • The API server is the front end for the Kubernetes control plane. • The main implementation of a Kubernetes API server is kube-apiserver. • kube-apiserver is designed to scale horizontally • You can run several instances of kube-apiserver and balance traffic between those instances.

AKS (Azure Kubernetes Service)

• Handles much of the complexity and operational overhead of managing Kubernetes. • Azure handles critical tasks like health monitoring. • The Kubernetes masters are managed by Azure. You only manage and maintain the agent nodes. • Lets you integrate with Azure Active Directory and use Kubernetes role-based access controls.

cloud-controller-manager

• It allows you to link your cluster into your cloud providers API. • will separate the components that interact with your cloud platform. • combines several logically independent control loops into a single binary that you run as a single process.

Pros of MSA

• Long-term flexibility • Higher ROI and better TCO (Total Cost of Ownership) • Easier fault isolation and bug fixing = higher resiliency. • Loose coupling is enforced by the architecture • Time-to-market: quickly get new features live. • Easily scalable with increasing load requirements! • Implement individual services in most appropriate technology

Controllers with cloud provider dependencies

• Node controller: For checking the cloud provider to determine if a node has been deleted in the cloud after it stops responding • Route controller: For setting up routes in the underlying cloud infrastructure • Service controller: For creating, updating and deleting cloud provider load balancers.

Containers

• Provide the runtime information for the application • Reside inside of Pods • They contain the application, libraries, and dependencies

Deployment

• Provides declarative updates for Pods and ReplicaSets. • Checks on the health of your Pod and restarts the Pod's container if it terminates. • The recommended way to manage the creation and scaling of Pods, unless you require custom update orchestration or don't require updates at all

MSA Requirements

• Quick server creation • Accurate Monitoring • Fast deployment • Employ Product-centered teams

Etcd

• _____ is a key-value store. It maintains all the clusters' data. • Single source of truth for all the components and nodes inside the cluster • Any component can query to get the state of the cluster

C#: Interfaces

• defines a contract that can be implemented by classes and structs. • can contain methods, properties, events. • does NOT provide implementations. It specifies the members that must be implemented by classes or structs • It is intended to express a "can do" relationship between an ______________and its implementing type. • are used to simulate multiple inheritance.

Kubectl

• is the command line tool for controlling Kubernetes clusters. • looks for a file named config in the $HOME/.kube directory. • uses the Kubernetes API to interact with the cluster

Cons of MSA

• relational DBs may be difficult to scale. ACID transactions increase overhead. • There are many more moving parts that can break so there must be more error handling and resiliency built into the system. •Different technologies used for each service can lead to difficulties: •when team members transition from one team to another.

Cons of MSA

•when maintaining a very diverse technology group, more personnel are needed. •High dependency between varying services can lead to a "microservices death star". •communication system between services can be hard to understand. IP addresses and ports can get out of sync when updating. •Harder to implement integration testing.

Monolith Issues

● One small change forces you to rebuild and redeploy the whole application as a new version. ● It's hard to keep the code well organized with strong abstractions. ● If one part of the app is a bottleneck the whole app is affected.


Kaugnay na mga set ng pag-aaral

Peritonitis and apendicitis Med Surg 1

View Set

RNSG 1413 - Exam 1 Sherpath Adaptive Quizzes

View Set

Chapter 9 - Reaching Global Markets

View Set

American History Unit 2: Lesson 2 - Settling the Frontier

View Set

PEDI Study Guide Ch. 6, 12, 13, 14, 16, 18, 32

View Set

CH 7 (The First 2 Years: Psychosocial Development)

View Set

Highway Design 5510 - Midterm 1 - Michael Shea

View Set

Computer Programming 13278 GENG 106 L02

View Set