Kubernetes Crash Course From TechWorld with Nana

Source

Misc

- K8s: Full blown Kubernetes. 3 x K8s masters, 3 x etcd, 2 x Ingress plus your worker nodes

  • K3s: Designed to be a single binary of less than 40MB that completely implements the Kubernetes API. In order to achieve this, they removed a lot of extra drivers that didn't need to be part of the core and are easily replaced with add-ons.

    Intro

    • Kubrenebts is OSS orchestration tool
    • Developed by Google
    • Help you manage containerized applications
    • How Kubernetes can help you?
      • Move from Monolithic to Microservices
        • Apps divided to microservices
      • Manage those containers (that could be 100 or more)
    • What features Kubernetes offers ?
      • HA
      • Scalability
      • DR - backup and restore

Kubernetes Architecture

K8 Architecture
  • Kubelet: agent that the cluster use to communicate.
  • Master node:
    • Important K8s processes that are running here to manage the cluster
      • API server:
        • Entry point to K8s cluster
          • Different clients talks to. like UI or CLI
      • Controller Manager:
        • Keep tracks of what happening in the cluster, if an application die and needs to be restarted etc.
      • Scheduler:
        • Intelligent scheduler to Pods, and decide which node the Pod should be scheduled depending on utilization
      • ETCD
        • K8 backing store (key/value): Hold all the data on the cluster (Pods status etc ) - so recovery usually starts with this storage.
      • Virtual network

Kubernetes Main Component

## Kubernetes Main Component
Pod close look
  • Pod: the square in blue

    • Smallest unit in Kubernetes.
    • A layer on top of Container, so regardless of container technology - Kubrenetes abstract that away that from you.
    • Usually 1 Application per Pod
    • Each Pod get an IP (internal IP)
    • Pod: are ephemeral , so when Pod dies because he applications inside it dies, another Pod get created and get a new ip address
  • Service:

    • DNS name.
    • It acts as load balancer between Pods.
    • Permeant ip than can be attached to the Pod
    • Lifecycle of Pod and Service are not connected.
    • Type of service:
      • External : https://node-ip:port (for web server, for testing).
      • Internal: https:// db-service-ip:port (for backend services).
  • Ingress

    • Requests get received here, and then Ingress forward it to Service.
    • Kubernetes traffic gateway
  • ConfigMap

    • External config for your application.
  • Secrets

    • User stores secret data in Base64 format.
    • This doesn't make things secure by default, where you need 3rd party tools. (like Vault?)
    • Certificates get stored here as well.
  • Volumes

    • The component which attach storage to Pods, whether a local storage or remote storage (Cloud, etc. )
    • K8 doesn't manage data persistence, it's on you to backup it etc.
  • Deployment

    • Used for StateLess Apps
    • Blueprint for "my-app" podcs
    • A layer of abstractions of Pods (where you don't work with Pods directly)
  • Statefulset

    • Used for STATEFUL apps or Databases (but if it's 1 replica, it's okay to use deployment)
      • Examples:
        • Mongodb
        • Elastic
        • MySQL
    • You create those services using Statefulsets and not Deployments.
    • Will take care of replicating the Pods
    • Not easy to deploy stateful apps in K8
    • Sometimes you have put the database outside of K8

Kubernetes Configuration

  • API server is the gateway for the clients
  • Request is either in JSON or YAML

3 important parts in Kubrenetes configuration file

  1. Metadata: what we are creating, Service or xxxx)
  2. Specification: What is the specification of the container? (how many replica, what's the desired state)
  3. Status: Automatically generated and added by Kubernetes. The cluster information and containers state gets stored in etcd.

YAML Configuration File

  • Syntax: Strict indentation.

Demo time

Demo architecture

K8 Demo architecture

Notes while deploying the demo:

  • Pods has it own spec section.
  • It's common to put Deployment and Service in the same file.
  • Labels
    • Labels are external identifiers than can be attached to K8 containers
    • For Pods, Labels are required.
    • Label Selectors:
      • Identify a set of resources
      • Match all Pods with labels "app:nginx" → knows which Pods are part of this deployment
  • Service
    • Target port should always forward to Container port
    • You need to make the service accessible from outside, and this happen with Node port.
    • There's a range for NodePort that's already defined in Kubernetes, you cannot just use any port.
  • Before deploying
    • ConfigMAP & Secrets needs to exists before running deployments

Issues I ran into while deploying the demo

Useful commands

  • kubectl get all
  • kubectl get node -o wide
  • kubectl describe component name (i.e: pods ) id
  • kubectl rollout restart name
  • kubectl apply -f webapp.yaml (when you change configuration file)

Specific Knowledge Unpacked

 

Naval Ravikent talks about specific knowledge, an interesting concept that could help you boost your value which will either increase your wealth or provide you with more options on how best to live.  In this post, I will unpack the concept and provide examples to better illustrate what I understood from his lecture.

What is specific knowledge?

Specific knowledge is a concept that cannot be taught. It is a compounding of knowledge that is acquired during the entire length of a person’s lifetime.  It is a mix of learned skills, encoded genes, and genuine curiosity. Let's examine each one individually.

Learned Skills

These are skills learned very early in childhood or a skill you have spent a lot of time acquiring. Therefore, it comes naturally to you as you grow older. The best example of this is language acquisition, which is quite easy for kids, but very difficult for adults.

Encoded Genes

This is a skill that’s embedded in you. Tasks that require this skill are performed easily by you, so much so that you get frustrated when others do not perform it as effortlessly as you. The best way to discover these types of skills is to take note of the compliments you dismiss.

Genuine Curiosity

To be curious is to be genuinely interested in something.  You are not curious just because someone says a thing is interesting. You are because you find joy and thrill when learning and reading about it.

 

These three things make it very hard to teach specific knowledge. It is specific to each person’s life, hence the word SPECIFIC!

 

Characteristics of Specific Knowledge

Here are a couple of characteristics that help you identify specific knowledge:

Nobody can figure out how to automate it

How do you automate something that’s just different in every aspect? No matter how you look at it, you cannot automate it.

Highly creative or technical

It's creative by nature and is accompanied by uncertainty or can be highly technical with a lot of complex details.

It happens as an output of combining uncombined disciplines

The first time I heard this phrase was on Tim Ferris’ podcast. It resonated with me because I tend to do it subconsciously, where I like to possess just enough knowledge to combine uncombined stuff, and it works!

 

 

How to find, build, and expand on specific knowledge?

On finding specific knowledge

Naval tells a great story here about how his mother helped him find his specific knowledge. When he was a kid, he used to critique pizza shops’ business strategies, menu design, offers, and suggest what they should and shouldn't do. One day he was talking to a friend whom he told he was going to be a scientist. His mother overheard, looked at him, and said "No, you are not. You are gonna do something with sales."

So ask the people around you, and they will tell you what it is. It's something that is observed and is revealed in the situation, not something you think about.

 

 

So How Can I Build And Expand My Specific Knowledge?

The best strategy Naval recommends is to look for what knowledge you have already built and capitalized on it. Here are a couple of ways you can expand specific knowledge:

Through apprenticeship

To be an apprentice is to accompany someone and learn from them. Naval recounts a Warren Buffet story about his time as an apprentice to Benjamin Graham:

The classic line here is that Warren Buffett went to Benjamin Graham when he got out of school. Benjamin Graham was the author of the Intelligent Investor and sort of modernized or created value investing as a discipline. And Warren Buffett went to Benjamin Graham and offered to work for him for free. 

And Graham said, “Actually, you’re overpriced, free is overpriced.” And Graham was absolutely right. When it comes to a very valuable apprenticeship like the type that Graham was going to give Buffet, Buffet should have been paying him a lot of money. That right there tells you that those are skills worth having. Source

 

On-the-job

I believe this refers to the skills you gain through tasks assigned to you by colleagues and bosses.

Self-taught

My best guess here is that this refers to the skills you pick up learning material to acquire. It's not something that you enroll in, like a university or course.  It's more of a self-catered curriculum of related/unrelated stuff.

By following the obsession and thinking about how to monetize at the back of mind

This one is my favorite. You cannot teach curiosity. You simply can't make someone genuinely curious about something. This is the cherry on the top of the cake when it comes to specific knowledge.

Examples of specific knowledge

Scott Adams

I think Scott Adams is a great example of people who exercise specific knowledge. He's a corporate guy with a business degree who is also a comic artist. It would be quite difficult to instill specific knowledge like Scott Adams’ type in people because it is derived by combining uncombined skills (for example, on the job training, artistic skills, business education, and writing skills).

 

 

Recommended reading on specific knowledge:

  1. Specific Knowledge Is Highly Creative or Technical
  2. What is specific knowledge by Thomas Waschenfelder
  3. Why Talented People Don’t Use Their Strengths

 

Book Review: Out of Place: A Memoir by Edward Said

Out Of Place Book Cover

I got to know Edward Said through a documentary that was produced by Thmanyah company a couple of months ago. The short documentary led me to watch a series of interviews with Edward, and I was astonished by Edward’s language use and expression. I was excited when I found out Edward wrote his memoir before he died, and I decided to read it in English, as it was written, to study his writing style carefully.

 

I feel like people who are not interested in Edward’s intellectual personality might find the book boring. The reason why I read Edward’s memoir was to understand the circumstances that produced a scholar like Edward. I wanted to know how a person could be so eloquent and what kind of education he received.

After I finished reading the memoir, I understood the circumstances that produced Edward, but it wasn’t as detailed as I was hoping.

Edward wrote mostly about his childhood and the years that preceded his time in the university. In the last quarter of the book, he talked briefly about his life in undergrad and grad school. There was no definite style in the storytelling, as he would occasionally narrate in boring detail and other times, quite briefly. For example, he wrote a couple of pages about a girl he used to date and then would proceed to summarize his first marriage experience in a single sentence.

However, when I think about the time period within which he wrote the memoir, it starts to make sense. Edward, God bless his soul, died in 2003. He wrote the memoir between 1994 and 1999 while fighting cancer. I think writing the memoir was a way of recalling good memories that brought life and joy to him, rather than retelling facts in a sequential manner.

I plan to read Edward’s other books in order to explore his work carefully, and I am at a loss as to whether to read the Arabic translation or read it in its original English.

What You Imagine When Hearing “Thought Experiment”?

Favorite drawings when searching "Thought Experiment" on Google Images

I have a strange relationship with the phrase “Thought Experiment.” It’s cool, but perhaps because I tend to think it was overused?

If you are unfamiliar with Thought Experiment, here's a video I like on the subject:

 

I tried to draw what it goes into my mind when hearing the phrase, but first, I searched Google images and found pretty cool stuff.

Let’s start with what I visualize when hearing the phrase

By Frits Ahlefeldt

I love it. The idea is excellent, and the drawing is clean and straightforward.

Also, I find the following comic is funny:

Since you conduct only thought-experiments, we were hoping you would, from time to time, come up with some thought-results.

The drawing style is fantastic. I never heard of Sidney Harris, but I plan to check one of his books.

What phrase you like/dislike, or you think it's overused?

The Only Business Book That I Want To Read

Every time I read a business book, I tend to dislike case studies from famous brands like Apple, Uber, etc. The reason being a lot of people from the outside shed light on some success factors and ignore many.

Not until I stumbled upon Indie Hackers podcast. Where Courtland Allen interview founders, who made a product that generates revenue and there we able to fund it in an unconventional way. What I love about is having the founder talking about the idea from the early stage until implementation and later growth.

What would be fantastic if the content of the podcast is transcribed and reworked to a book where we can skim through examples, and study them the interviews closely.

Transfer Of Power: Thank You Guido Van Rossum

Sketch for python announcement
Am I missing any dependencies?

Back in college, I majored in computer science. Between 2004 and 2007, I was passionate about graphic design, and somehow I concluded that computer science must teach graphic design in a way or another. ( Hey! don't laugh at my thought process ?)

In the first semester, we had a course named CS 152.  It meant to teach us the basics of programming using C. It was overwhelming understanding the logic and dealing with the technicalities of C at the same time. So I remember, and I could be wrong, that every time you want to write a simple program that prints a "Hello World," you need to write something like this:

#include <stdio.h>
int main()
{
printf("Hello, World!");
return 0;
}

At the time, I didn't understand why I should write "#include" and (int main), and it wasn't a great intro to programming for me.

Nowadays, I believe if the instructor decided to teach us an intuitive programming language like Python, I think my experience will be different.

Why do I include this long introduction?

I was browsing my twitter feed the other day and saw Guido van Rossum, the creator of Python, decided to step down. After 29 years of development, he decided to be less active on the core development.

When I read the article, the following questions came to mind :

  • Looking back, how does he feel spending all of this time on creating the language? Was it worth it?
  • How it does it feel working on one thing for your whole life? (not sure if he has other things going on at the same time)
  • How does it feel seeing the stuff you created goes unfavorable paths?

In my current mindset, I can't work on one thing for this long. However,  In this history of open source, a few people come to mind who still maintain what they created like Linus Torvalds, Linux creator, Daniel Stenberg, Curl creator, and many others. I admire their dedication and commitment.

While writing this post, I stumbled upon Guido van Rossum proposal to DARBA to create computer programming for everybody, which later became Python.

How Much Time Should You Allocate To Wild Bets?

I was listening to Eric Schmidt interview with Tim Ferris when Tim asked him on how Google manages its resources:

 

Tim Ferriss: Could you describe or explain what the 70-20-10 model is? If that’s the right term to use.

Eric Schmidt: That’s correct. So this was Sergey’s idea. And the question was: how do we organize our resources in terms of core things, new things, and experimental things? So Sergey — and we had an offsite with the whole management team, I still remember. And Sergey got up on the board and he did some math. He’s a brilliant mathematician, and at the end of the math he said, “The right answer is 70-20-10. 70% on your core business, 20% on adjacent or nearby things, and 10% on wild bets.” And he said that, “All of these numbers are right, you need the 70% because you need the revenue, the revenue growth. You need the 20% because you need to extend your franchise, and you need the 10%, which is crucially important for the things that you will want to do five or 10 years from now.”

 

And then a question popped in my head. Can we apply this concept to personal resources (i.e., time)? For example, we spend 70% on the stuff we know that makes us an income, 20% on nearby things and 10% on the field you like to get into or stuff you are doing for the future? (Getting a master/Nanodegree/side hustle)

 

Not sure if this can be applied on a personal level. One of the challenges would be how to focus. Also, I think on a personal level the percentage would be 70 – 80% on core business (typically your day job) and 10-20%  on side projects (wild bets).

Polymath vs Jack of All Trades

Failed attempt to show the difference between polymath and jack of all trades (inspired by this sketch)

Disclaimer: I am trying to wrap my unfocused self in some cool terms like “polymath” – also when someone asks you in a job interview how you know such and such, don't mention the word polymath.

I had breakfast today with my friend Ahmed, and the question around Polymath vs. jack of all trades came up. After googling for 2 minutes, it looks like:

 

Jack of all trades: Understand the basics in a lot of stuff ( > 5 stuff ) no source of this number, I making this up.

 

Polymath: Knows 2-4 stuff very well and he/she expert in those fields.

 

My question: is polymath a jack of all trades + mental models?

 

The value of multidisciplinary is tremendous if it was dedicated to the right efforts. I believe a person with such capabilities and horizon will find a hard time finding the right opportunity and perhaps need to create it themselves.

When You Don’t Get Better with Repetition

Remember how they always say that you get better with reputation? Do you think this is true all the time? What about if you keep repeating something wrong over and over and you get 10% improvement instead of 30%?

This how all started. I was reading Great at Work the other day, and the following paragraph caught my attention:

Top performers did less and more: less volume of activities, more concentrated effort. This insight overturns much conventional thinking about focusing that urges you to choose a few tasks to prioritize. Choice is only half of the equation—you also need to obsess. This finding led us to reformulate the “work scope” practice and call it “do less, then obsess.”

Hansen, Morten T. Great at Work: How Top Performers Do Less, Work Better, and Achieve More (pp. 5-6). Simon & Schuster. Kindle Edition

And then this ...

 

Power of One: Pick one and only one skill at a time to develop. It’s hard to master a skill if you’re also working on ten others.

Hansen, Morten T. Great at Work: How Top Performers Do Less, Work Better, and Achieve More (p. 75). Simon & Schuster. Kindle Edition.

Let me try to digest that with something I am trying to excel at which is writing and drawing (you would figure this out by reading this blog ?)

If I want to be a better writer, should I read more books or take two paragraphs that I like and study them word by word? (Got this tip from Safi Bahcall)

If I want to better at drawing, do I entirely focus on how small details make a difference or should I keep copying tons of illustrations without being fully in the moment?

What’s this process even called? Exploration? Awareness? Attention? Focus? And when this process should be applied? In the beginning or half-way through the learning process?

 

I don't know the answer to that, but it's something I am trying to figure out.

Acronyms And Safi Bahcall

Acronym to remember stuff. Who does that? Well, looks like Safi Bahcall does it. He uses this method mainly to remember stuff as per his interview with Tim Ferris . Let’s look to the following  examples:

 

  • FBR: This refers to a writing process. You write fast, bad and wrong. The process helps you to get in the flow. Do not stop to fact check an information , lookup the right name or correct a misspelled word .
  • BLC: bankers, lawyers, or consultants. He used this acronym in an invite to gatherings he used to set up in NYC where he explicitly wrote no BLC ?

 

I like the approach. I am going to to do that with new concepts that I want to remember and practice.

 

What an acronym you like to use or recently invented?