added nodeport k8s in svc
This commit is contained in:
@@ -107,6 +107,7 @@ spec:
|
|||||||
> 🧠 **Tip:** Use `kubectl describe svc <service-name>` to inspect the service and verify connectivity.
|
> 🧠 **Tip:** Use `kubectl describe svc <service-name>` to inspect the service and verify connectivity.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
@@ -124,3 +125,20 @@ spec:
|
|||||||
port: 80
|
port: 80
|
||||||
targetPort: 8080
|
targetPort: 8080
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: db-svc
|
||||||
|
namespace: db
|
||||||
|
spec:
|
||||||
|
type: NodePort
|
||||||
|
ports:
|
||||||
|
- name: sql
|
||||||
|
port: 3306
|
||||||
|
targetPort: 3306
|
||||||
|
nodePort: 30000
|
||||||
|
selector:
|
||||||
|
app: db
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user