how to create service in kubernetes code example
Example 1: k8s service example
apiVersion: v1
kind: Service
metadata:
name: my-service
spec:
selector:
app: MyApp
ports:
- protocol: TCP
port: 80
targetPort: 9376
Example 2: kubectl run create service
kubectl expose deployment/my-nginx
Example 3: kubectl run create service
service/my-nginx exposed