Kubernetes Deploy Example - Part 1

Kubernetes is a container orchestration system for automating application deployment, scaling and management. Here we will show a simple example of nginx deployment by kubernetes.

Requirements

  1. install kubernetes, for me, I use minikube
  2. install docker

Step 1: Pull the image from Docker Registry

1
2
$ kubectl run nginx --image=nginx:latest --port=80

Step 2: Check if deployment ok

1
2
3
4
5
$ kubectl get pods

NAME READY STATUS RESTARTS AGE
nginx-6bfb654d7c-xjvhg 1/1 Running 0 1h

Step 3: Expose service through NodePort

As I use minikube in local, I don’t have LoadBalancer installed, so I use NodePort as type here

1
2
3
4
kubectl expose deployment nginx --type=NodePort --port=80 --target-port=80

service "nginx" exposed

Step 4: Get service port

1
2
3
4
5
kubectl get svc nginx

NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
nginx NodePort 10.109.174.66 <none> 80:32598/TCP 45m

Here we can find that the service if exposed by port 32598

Step 5: Get kubernetes ip

1
2
3
4
5
kubectl get endpoints kubernetes

NAME ENDPOINTS AGE
kubernetes 192.168.99.100:8443 143d

Step 6: Access to nginx

Open your navigator and type the url of kubernetes with the port of nginx, you will access to welcome page of nginx

1
2
http://192.168.99.100:32598

Avro vs Parquet

Avro

Apache Avro is a remote procedure call and data serialization framework developed with Apache Hadoop project. It uses Json for defining data types and protocols and serialize data in compact binary format.
Avro stores both schema and data together in one message or file.
A key feature of Avro is robust support for data schemas that change over time, called scheam evolution.

Avro

  • Row based format
  • Schema is stored as JSON within the file
  • It is also a Serialization and RPC framework
  • Files support block compression and are splittable
  • Can be written from streaming data (eg Apache Kafka)
  • Excellent with schema evolution

Parquet

Parquet is a columnar file format that provides optimizations to speed up queries and a far more efficient file format than csv or json

Parquet

  • Column based format
  • Schema is stored in the footer of the file
  • Due to merging of schema across multiple files, schema evolution is expensive
  • Excellent for selected column data consumption and processing
  • Can’t be written from streaming data since it needs to wait for blocks to get finished. However, this will work using micro-batch (eg Apache Spark).
  • Working excellent with spark as there is vectorized reader for parquet

My First Blog

The first time I tried to write a blog, this is a start. . .

My Blog

Why to write blog

2018 is coming soon. I think that I came to France alone in 2009 and came to this country where everything is strange. Now I have not seen it for more than 8 years. During this period, I went to school, graduated, and found a job. Later, in love, marriage, childbirth, and embarrassment, there have been five or six years of experience in the world of programmers.

I really want to leave something for my life, even if I want to make a simple record, I also want to communicate with my friends, and I have some experience in life.

However, my writing is really a dish, and I haven’t written it for many years. There is no way, I can only bite my head.

Seeing a summary of a peer on the Internet feels very good, use it to borrow, as an original intention of a personal blog.

  • Accumulate Accumulate experience in work and gain in life.
  • Record Use the blog as a diary to record what you see and hear in your work life.
  • Share As a programmer, you must have an “open source” spirit.
  • Communication Blog is a big circle.
  • Learning I always learn knowledge here, just like reading it every day.

Blog’s content

  • Tell the world of programmers and reprint some technically and nutritious articles.

  • Some stories about living abroad

Ok, the first blog is simply recorded here, my blog journey starts here!