Our first Kubernetes application
Before we move on, let's take a look at these three concepts in action. Kubernetes ships with a number of examples installed, but we'll create a new example from scratch to illustrate some of the concepts.
We already created a pod definition file but, as you learned, there are many advantages to running our pods via replication controllers. Again, using the book-examples/02_example
folder we made earlier, we'll create some definition files and start a cluster of Node.js servers using a replication controller approach. Additionally, we'll add a public face to it with a load-balanced service.
Use your favorite editor to create the following file and name it as nodejs-controller.yaml
:
apiVersion: v1 kind: ReplicationController metadata: name: node-js labels: name: node-js spec: replicas: 3 selector: name: node-js template: metadata: labels: name: node-js spec: containers: - name: node-js ...