Basic kubectl commands

The following commands should help you get started with Kubernetes and kubectl.

Get information about your cluster

List the resources available in your cluster. More details

kubectl get nodes
kubectl get deployments
kubectl get pods
kubectl get all

Run a container

It’s like docker run with a little bit different syntax. More details

kubectl run <name> --image=<image> --port=8080

Get logs from a container

This will output the logs from the container into your terminal. More details

kubectl logs <pod_name>

Execute command in container

This executes the env command in the container and displays the result. More details

kubectl exec <pod_name> env

read more

How to delete all local branches except master in git

The idea is to list the local branches using git branch, filter the results and apply git branch -d for each line.

Linux/MacOS

git branch | grep -v master | xargs git branch -d

git branch lists all available local branches. With grep -v the master branch is filtered out. Then each line is passed to git branch -D using xargs.

Windows

FOR /f "tokens=*" %%G IN ('git branch ^| findstr /v master') DO git branch -d %%G

The same idea here, but with different tools. Instead of grep -v we’ll use findstr /v. Unfortunately xargs has no alternative, the only way is to use a for loop.

read more

How to use HTML entities without dangerouslySetInnerHTML in React

There may be times when you will want to render a string with HTML entities in it in your React application. An HTML entity is a piece of text (string) that begins with an ampersand (&) and ends with a semicolon (;). They are frequently used to display reserved and invisible characters, like non-breaking spaces (&nbsp;) or soft hyphens (&#8203;) for marking line breaking opportunities.

To render these characters, you need to use dangerouslySetInnerHTML:

function createMarkup(myTextFromDatabase) {
  return {__html: myTextFromDatabase};
}

function MyComponent({myTextFromDatabase}) {
  return <div dangerouslySetInnerHTML={createMarkup(myTextFromDatabase)} />;
}

const myTextFromDatabase = 'First &middot; Second';
<MyComponent myTextFromDatabase={myTextFromDatabase />}

read more

Building the Boeing 777 Documentary (21st Century Jet)

Building the Boeing 777 Documentary (21st Century Jet)

If you are into Lean manufacturing and product development, you should watch this beautiful documentary about the development and manufacturing of the Boeing 777 aircraft from 1996. It took 5 years and 5 billion dollars to build it from scratch. Ten thousand people worked on it together under Alan Mulally.

Mulally created an entirely new management system for the Boeing 777 program. He focused his energies on Working Together: design/build teams were created with members from design, manufacturing, suppliers, and customer airlines. There were no secrets in the teams, everyone was urged “share early and share often”.

The management system was based on W. Edwards Deming’s playbook and 14 Points.

The documentary has 5 episodes, each around one hour long.

read more