Created
January 17, 2023 05:43
-
-
Save smijar/442f87791b0e94d434b897b20fab7054 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
# To deploy: kubectl apply -f nginx-hello-world-deployment.yaml | |
# Access it with the API as a proxy: | |
# $ kubectl proxy | |
# Then in your browser: http://localhost:8001/api/v1/namespaces/default/services/nginx:/proxy/#!/ | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: nginx | |
spec: | |
type: NodePort | |
ports: | |
- port: 80 | |
targetPort: 80 | |
nodePort: 30001 | |
selector: | |
app: nginx | |
--- | |
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
name: nginx-config | |
data: | |
nginx.conf: ' | |
events { | |
} | |
http { | |
server { | |
listen 80; | |
location / { | |
return 200 "Hello world!"; | |
} | |
} | |
} | |
' | |
--- | |
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: nginx | |
spec: | |
selector: | |
matchLabels: | |
app: nginx | |
strategy: | |
type: Recreate | |
template: | |
metadata: | |
labels: | |
app: nginx | |
spec: | |
containers: | |
- image: nginx:latest | |
name: nginx | |
ports: | |
- containerPort: 80 | |
name: web | |
volumeMounts: | |
- name: config-vol | |
mountPath: /etc/nginx/ | |
volumes: | |
- name: config-vol | |
configMap: | |
name: nginx-config | |
items: | |
- key: nginx.conf | |
path: nginx.conf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment