forked from chronolaw/k8s_study
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
131 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# chrono @ 2022-06 | ||
|
||
# kubectl apply -f ngx-deploy.yml | ||
# kubectl port-forward svc/ngx-svc 8080:80 & | ||
# curl 127.1:8080 | ||
|
||
# kubectl rollout status deployment ngx-dep | ||
# kubectl rollout history deployment ngx-dep | ||
|
||
--- | ||
|
||
# this cm will be mounted to /etc/nginx/conf.d | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: ngx-conf | ||
|
||
data: | ||
default.conf: | | ||
server { | ||
listen 80; | ||
location / { | ||
default_type text/plain; | ||
return 200 | ||
'ver : $nginx_version\nsrv : $server_addr:$server_port\nhost: $hostname\n'; | ||
} | ||
} | ||
--- | ||
|
||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: ngx-dep | ||
annotations: | ||
kubernetes.io/change-cause: v1, ngx=1.21 | ||
|
||
spec: | ||
#minReadySeconds: 5 | ||
|
||
replicas: 4 | ||
selector: | ||
matchLabels: | ||
app: ngx-dep | ||
|
||
template: | ||
metadata: | ||
labels: | ||
app: ngx-dep | ||
spec: | ||
volumes: | ||
- name: ngx-conf-vol | ||
configMap: | ||
name: ngx-conf | ||
|
||
containers: | ||
- image: nginx:1.21-alpine | ||
name: nginx | ||
ports: | ||
- containerPort: 80 | ||
|
||
volumeMounts: | ||
- mountPath: /etc/nginx/conf.d | ||
name: ngx-conf-vol | ||
|
||
--- | ||
|
||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: ngx-svc | ||
|
||
spec: | ||
selector: | ||
app: ngx-dep | ||
|
||
ports: | ||
- port: 80 | ||
protocol: TCP | ||
targetPort: 80 | ||
|
||
--- | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# chrono @ 2022-06 | ||
|
||
# kubectl apply -f ngx-deploy.yml | ||
# kubectl port-forward svc/ngx-svc 8080:80 & | ||
# curl 127.1:8080 | ||
|
||
# kubectl rollout status deployment ngx-dep | ||
# kubectl rollout history deployment ngx-dep | ||
|
||
--- | ||
|
||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: ngx-dep | ||
annotations: | ||
kubernetes.io/change-cause: update to v2, ngx=1.22 | ||
|
||
spec: | ||
#minReadySeconds: 5 | ||
|
||
replicas: 4 | ||
selector: | ||
matchLabels: | ||
app: ngx-dep | ||
|
||
template: | ||
metadata: | ||
labels: | ||
app: ngx-dep | ||
spec: | ||
volumes: | ||
- name: ngx-conf-vol | ||
configMap: | ||
name: ngx-conf | ||
|
||
containers: | ||
- image: nginx:1.22-alpine | ||
name: nginx | ||
ports: | ||
- containerPort: 80 | ||
|
||
volumeMounts: | ||
- mountPath: /etc/nginx/conf.d | ||
name: ngx-conf-vol | ||
|
||
--- | ||
|