Kubernetes Service Operations: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 2: Line 2:
* [[Kubernetes Operations#Service_Operations|Kubernetes Operations]]
* [[Kubernetes Operations#Service_Operations|Kubernetes Operations]]
* [[Kubernetes_Service_Concepts#Service_Operations|Kubernetes Service Concepts]]
* [[Kubernetes_Service_Concepts#Service_Operations|Kubernetes Service Concepts]]
=List Services=
<syntaxhighlight lang='bash'>
kubectl [-n <namespace>] get svc
</syntaxhighlight>
=Describe a Service=
<syntaxhighlight lang='bash'>
kubectl [-o yaml] get svc <service-name>
</syntaxhighlight>
<syntaxhighlight lang='bash'>
kubectl describe svc <service-name>
</syntaxhighlight>


=Create a Service=
=Create a Service=

Revision as of 00:38, 20 September 2020

Internal

List Services

kubectl [-n <namespace>] get svc

Describe a Service

kubectl [-o yaml] get svc <service-name>
kubectl describe svc <service-name>

Create a Service

With CLI

A service of any type (ClusterIP, NodePort, LoadBalancer, or ExternalName) can be created with the kubectl expose command.

More details:

kubectl expose

With Metadata

Describe the service in a metadata YAML file:

apiVersion: v1
kind: Service
metadata:
  name: some-service
spec:
  selector:
    function: serves-http
  ports:
  - port: 80
    targetPort: 8888

More details about the service manifest available in:

Kubernetes Service Manifest

POST it with:

kubectl apply -f ./service.yaml