27 lines
		
	
	
		
			410 B
		
	
	
	
		
			YAML
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
		
			410 B
		
	
	
	
		
			YAML
		
	
	
	
	
	
| # A nginx instance with a NodePort.
 | |
| ---
 | |
| apiVersion: v1
 | |
| kind: Pod
 | |
| metadata:
 | |
|   name: nginx
 | |
|   labels:
 | |
|     app: nginx
 | |
| spec:
 | |
|   containers:
 | |
|   - name: nginx
 | |
|     image: nginx:1.21
 | |
| ---
 | |
| apiVersion: v1
 | |
| kind: Service
 | |
| metadata:
 | |
|   name: nginx
 | |
| spec:
 | |
|   ports:
 | |
|   - port: 8123 # Port exposed in cluster
 | |
|     targetPort: 80 # Port inside container
 | |
|     protocol: TCP
 | |
|     nodePort: 31234
 | |
|   selector:
 | |
|     app: nginx
 | |
|   type: NodePort
 |