Kubernetes Service Operations: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 50: | Line 50: | ||
Services can be tested as follows: | Services can be tested as follows: | ||
* Deploy an auxiliary pod, [[Kubectl_exec|kubectl exec]] into it and attempt to connect to the target pods via the service. | * Deploy an auxiliary pod, [[Kubectl_exec|kubectl exec]] into it and attempt to connect to the target pods via the service. | ||
* ssh into a [[Kubernetes_Control_Plane_and_Data_Plane_Concepts#Node|Kubernetes node]] and use the curl command from there. | * ssh into a [[Kubernetes_Control_Plane_and_Data_Plane_Concepts#Node|Kubernetes node]] and use the [[curl]] command from there. |
Revision as of 00:54, 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:
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:
POST it with:
kubectl apply -f ./service.yaml
Service Troubleshooting
Services can be tested as follows:
- Deploy an auxiliary pod, kubectl exec into it and attempt to connect to the target pods via the service.
- ssh into a Kubernetes node and use the curl command from there.