Last active
May 31, 2023 16:21
-
-
Save rahuls360/8c916bf808fbe41a3cc7721417cfa246 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: nginx-deployment # k8s deployment creates pods (instances of containers) and ensures the spec mentioned below is maintained (declarative) | |
spec: | |
selector: | |
matchLabels: | |
app: nginx-app # container name - used for ensure replica count is always maintained | |
replicas: 1 # no of pods to run | |
template: | |
metadata: | |
labels: | |
app: nginx-app # container name | |
spec: | |
containers: | |
- name: nginx-app # container name | |
image: my-nginx-image # docker image name. Have this build already | |
imagePullPolicy: Never # Don't pull from remote docker registry during local testing | |
ports: | |
- containerPort: 80 | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: nginx-service # a service exposes deployments/pods to other microservices in our cluster/external traffic | |
spec: | |
selector: | |
app: nginx-app # container name | |
ports: | |
- name: http | |
port: 80 | |
targetPort: 80 |
Author
rahuls360
commented
May 31, 2023
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment