Creating Services through Declarative Syntax
Learn to create Services through declarative syntax.
We'll cover the following...
Looking into the syntax
We can accomplish a similar result as the one using kubectl expose
through the go-demo-2-svc.yml
specification shown below:
Press + to interact
apiVersion: v1kind: Servicemetadata:name: go-demo-2spec:type: NodePortports:- port: 28017nodePort: 30001protocol: TCPselector:type: backendservice: go-demo-2
-
Lines 1–4: Since we have already discussed the meaning of
apiVersion
,kind
, andmetadata
, we’ll jump straight into the spec section. -
Line 5: Since we have already explored some of the options through the
kubectl expose
command, thespec
should be relatively easy to grasp. ...
Access this course and 1400+ top-rated courses and projects.