Kubernetes – Services

A Service is an abstraction which defines a logical set of Pods and a policy by which to access them (sometimes this pattern is called a micro-service).

Service | Kubernetes

Creating a service

<Example> A service on top of nginx pods that were create by a deployment

  • Create a YAML file
apiVersion: v1
kind: Service
  name: nginx-service
    app: my-nginx
  - protocol: TCP
    port: 80
    targetPort: 80
    nodePort: 30085
  type: NodePort
  • Run or apply
kubectl create -f <yaml-file>
kubectl apply -f <yaml-file>

Working with services in the cluster

kubectl get service

kubectl describe service <service-name>

kubectl delete service <service-name>

Checking the status of the kubelet service

sudo systemctl status kubelet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s