|
| 1 | +apiVersion: apps/v1 # API version |
| 2 | +kind: Deployment # Type of kubernetes resource |
| 3 | +metadata: |
| 4 | + name: chat-server # Name of the kubernetes resource |
| 5 | + labels: # Labels that will be applied to this resource |
| 6 | + app: chat-server |
| 7 | +spec: |
| 8 | + replicas: 1 # No. of replicas/pods to run in this deployment |
| 9 | + selector: |
| 10 | + matchLabels: # The deployment applies to any pods mayching the specified labels |
| 11 | + app: chat-server |
| 12 | + template: # Template for creating the pods in this deployment |
| 13 | + metadata: |
| 14 | + labels: # Labels that will be applied to each Pod in this deployment |
| 15 | + app: chat-server |
| 16 | + spec: # Spec for the containers that will be run in the Pods |
| 17 | + containers: |
| 18 | + - name: chat-server |
| 19 | + image: callicoder/spring-boot-websocket-chat-demo:0.0.1-SNAPSHOT |
| 20 | + imagePullPolicy: IfNotPresent |
| 21 | + ports: |
| 22 | + - name: http |
| 23 | + containerPort: 8080 # The port that the container exposes |
| 24 | +--- |
| 25 | +apiVersion: v1 # API version |
| 26 | +kind: Service # Type of the kubernetes resource |
| 27 | +metadata: |
| 28 | + name: chat-server # Name of the kubernetes resource |
| 29 | + labels: # Labels that will be applied to this resource |
| 30 | + app: chat-server |
| 31 | +spec: |
| 32 | + type: NodePort # The service will be exposed by opening a Port on each node and proxying it. |
| 33 | + selector: |
| 34 | + app: chat-server # The service exposes Pods with label `app=polling-app-server` |
| 35 | + ports: # Forward incoming connections on port 8080 to the target port 8080 |
| 36 | + - name: http |
| 37 | + port: 8080 |
| 38 | + targetPort: 8080 |
0 commit comments