Kubernetes Get Started

Md Khadeer
2 min readDec 6, 2019

Install Docker Desktop

The best way to get started developing containerized applications is with Docker Desktop, for OSX or Windows. Docker Desktop will allow you to easily set up Kubernetes or Swarm on your local development machine, so you can use all the features of the orchestrator you’re developing applications for right away, no cluster required. Follow the installation instructions appropriate for your operating system:

Enable Kubernetes

Docker Desktop will set up Kubernetes for you quickly and easily. Follow the setup and validation instructions appropriate for your operating system:

OSX

  1. After installing Docker Desktop, you should see a Docker icon in your menu bar. Click on it, and navigate Preferences… -> Kubernetes
  2. Check the checkbox labeled Enable Kubernetes, and click Apply. Docker Desktop will automatically set up Kubernetes for you. You’ll know everything has completed successfully once you can click on the Docker icon in the menu bar, and see a green light beside ‘Kubernetes is Running’.
  3. In order to confirm that Kubernetes is up and running, create a text file called pod.yaml with the following content:
apiVersion: v1
kind: Pod
metadata:
name: test
spec:
containers:
- name: myfristpod
image: alpine:3.5
command: ["ping", "8.8.8.8"]

This describes a pod with a single container, isolating a simple ping to 8.8.8.8.

4. In a terminal, navigate to where you created pod.yaml and create your pod:

kubectl apply -f pod.yaml

5. Check that your pod is up and running:

kubectl get pods

You should see something like:

NAME      READY     STATUS    RESTARTS   AGE
test 1/1 Running 0 4s

6. Check that you get the logs you’d expect for a ping process:

kubectl logs test

You should see the output of a healthy ping process:

PING 8.8.8.8 (8.8.8.8): 56 data bytes
64 bytes from 8.8.8.8: seq=0 ttl=37 time=21.393 ms
64 bytes from 8.8.8.8: seq=1 ttl=37 time=15.320 ms
64 bytes from 8.8.8.8: seq=2 ttl=37 time=11.111 ms
...

7. Finally, tear down your test pod:

kubectl delete -f pod.yaml

--

--