Skip to content

Latest commit

 

History

History
57 lines (57 loc) · 1.27 KB

hs5.md

File metadata and controls

57 lines (57 loc) · 1.27 KB

Http server

5. Create Kubernetes replica-controller and service setup files.

  • Read Kubernetes overview in the official user's guide.
  • Use below example and create replication controller file controller.yaml.
    • Pick a name and change all sitting-duck in the file.
    • Change the containers section with your docker image.
apiVersion: v1
kind: ReplicationController
metadata:
  name: sitting-duck
  labels:
    name: sitting-duck
spec:
  replicas: 1
  selector:
    name: sitting-duck
  template:
    metadata:
      labels:
        name: sitting-duck
    spec:
      containers:
      - name: duck
        image: gosharplite/duck:v4
        command:
        - /duck
        - -delay
        - "62"
        ports:
        - containerPort: 80
  • Use below example and create service file service.json.
    • Use the same name you pick previously and change all sitting-duck in the file.
{
   "kind":"Service",
   "apiVersion":"v1",
   "metadata":{
      "name":"sitting-duck",
      "labels":{
         "name":"sitting-duck"
      }
   },
   "spec":{
      "ports": [
        {
          "port":80
        }
      ],
      "selector":{
         "name":"sitting-duck"
      },
      "type": "NodePort"
   }
}