what is the meaning of status value in Kubernetes manifest file

1/7/2018

what is the meaning for "status:" in the kubernetes manifest file

spec:
  type: LoadBalancer
  ports:
  - name: "7000"
    port: 7000
    targetPort: 80
  selector:
    io.kompose.service: ams-app
status:
  loadBalancer: {}
-- kumar
kubernetes

1 Answer

1/7/2018

See "Object Spec and Status"

Every Kubernetes object includes two nested object fields that govern the object’s configuration: the object spec and the object status.

  • The spec, which you must provide, describes your desired state for the object–the characteristics that you want the object to have.
  • The status describes the actual state of the object, and is supplied and updated by the Kubernetes system.

At any given time, the Kubernetes Control Plane actively manages an object’s actual state to match the desired state you supplied.

So:

For example, a Kubernetes Deployment is an object that can represent an application running on your cluster.
When you create the Deployment, you might set the Deployment spec to specify that you want three replicas of the application to be running.
The Kubernetes system reads the Deployment spec and starts three instances of your desired application–updating the status to match your spec.
If any of those instances should fail (a status change), the Kubernetes system responds to the difference between spec and status by making a correction–in this case, starting a replacement instance.

In your case, what you mention matches the publication of a Service of type LoadBalancer.

The actual creation of the load balancer happens asynchronously, and information about the provisioned balancer will be published in the Service’s status.loadBalancer field.
For example:

kind: Service
apiVersion: v1
metadata:
  name: my-service
spec:
  selector:
    app: MyApp
  ports:
  - protocol: TCP
    port: 80
    targetPort: 9376
  clusterIP: 10.0.171.239
  loadBalancerIP: 78.11.24.19
  type: LoadBalancer
status:
  loadBalancer:
    ingress:
    - ip: 146.148.47.155
-- VonC
Source: StackOverflow