The command line

In the previous chapter, we briefly touched upon how you can use YAML or JSON files to define your pods, ReplicaSets, and services. Let's use kubectl to launch to an application that is to the preceding one.

First of all, we need a file to launch; you can find a copy of the following one, which is called cli-hello-world.yml, in the Chapter03 folder of the code bundle and GitHub repository that accompany this title:

apiVersion: v1kind: Servicemetadata:  name: cli-hello-worldspec:  selector:    app: cli-hello-world  type: NodePort  ports:  - protocol: TCP    port: 8000    targetPort: 80---apiVersion: apps/v1beta1kind: Deploymentmetadata:  name: cli-hello-world  labels:    app: nginxspec:  replicas: 1  selector:    matchLabels: app: cli-hello-world ...

Get Kubernetes for Serverless Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.