中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁 > news >正文

dw做網(wǎng)站背景圖片設(shè)置鋪平網(wǎng)頁怎么搜索關(guān)鍵詞

dw做網(wǎng)站背景圖片設(shè)置鋪平,網(wǎng)頁怎么搜索關(guān)鍵詞,java開發(fā)就是做網(wǎng)站么,wordpress 客服彈窗插件目錄 一.創(chuàng)建helm chart(以nginx為例) 1.通過create去創(chuàng)建模板 2.查看模板下的文件 3.用chart模版安裝nginx 二.版本更新和回滾問題 1.使用upgrade -f values.yaml或者命令行--set來設(shè)置 2.查看歷史版本并回滾 三.helm模板內(nèi)管道和函數(shù) 1.defau…

目錄

一.創(chuàng)建helm chart(以nginx為例)

1.通過create去創(chuàng)建模板

2.查看模板下的文件

3.用chart模版安裝nginx

二.版本更新和回滾問題

1.使用upgrade -f values.yaml或者命令行--set來設(shè)置

2.查看歷史版本并回滾

三.helm模板內(nèi)管道和函數(shù)

1.defautl

2.quote

3.indent和nindent

4.upper

5.title

6.toYaml


上一篇文章說到,我們可以通過helm將眾多已經(jīng)初步配置好的yaml文件下載來整合使用,甚至還可以自己定義好需要的安裝參數(shù)用于下載完成后直接使用而不需要過多更改,現(xiàn)在仍然可以在這些功能上繼續(xù)推進(jìn)。創(chuàng)建helm chart模板,現(xiàn)成的yaml文件,自己只需要更改values變量文件即可,如下:

一.創(chuàng)建helm chart(以nginx為例)

1.通過create去創(chuàng)建模板

[root@k8s-master helm]# helm create nginx  #創(chuàng)建完成后會(huì)在本地創(chuàng)建一個(gè)nginx目錄
drwxr-xr-x 4 root ?  root ? ? ? ? 93 Mar 18 19:58 nginx
[root@k8s-master helm]# tree nginx
nginx
├── charts ? #存放的依賴的子chart
├── Chart.yaml ? ? #存放chart基本信息的文件 
├── templates ? ? #模板,名稱都簡單翻譯一下就懂存的是什么
│?? ├── deployment.yaml
│?? ├── _helpers.tpl ? #模板助手
│?? ├── hpa.yaml ? ?
│?? ├── ingress.yaml
│?? ├── NOTES.txt ? #本chart的幫助信息
│?? ├── serviceaccount.yaml
│?? ├── service.yaml
│?? └── tests
│?? ? ? └── test-connection.yaml
└── values.yaml ? #存儲(chǔ)的是你在的templates中文件需要用到的變量
?
3 directories, 10 files

2.查看模板下的文件

[root@k8s-master helm]# cat nginx/templates/service.yaml 
apiVersion: v1
kind: Service
metadata:name: {{ include "nginx.fullname" . }} ?  #這些使用{{}}括起來的變量就是你需要在values.yaml文件中用值替換的變量labels:{{- include "nginx.labels" . | nindent 4 }}
spec:type: {{ .Values.service.type }}ports:- port: {{ .Values.service.port }}targetPort: httpprotocol: TCPname: httpselector:{{- include "nginx.selectorLabels" . | nindent 4 }}
?

3.用chart模版安裝nginx

(1)在values.yaml中定義變量,如下是nginx模版的原始文件

[root@k8s-master nginx]# cat values.yaml 
# Default values for nginx.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
?
replicaCount: 1
?
image:repository: nginx ?  #找到需要的地方,這里是鏡像名pullPolicy: IfNotPresent ? #鏡像拉取策略# Overrides the image tag whose default is the chart appVersion.tag: "" ?  #版本信息
?
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
?
serviceAccount:# Specifies whether a service account should be createdcreate: true# Annotations to add to the service accountannotations: {}# The name of the service account to use.# If not set and create is true, a name is generated using the fullname templatename: ""
?
podAnnotations: {}
?
podSecurityContext: {}# fsGroup: 2000
?
securityContext: {}# capabilities:# ? drop:# ? - ALL# readOnlyRootFilesystem: true# runAsNonRoot: true# runAsUser: 1000
?
service: ?  #service類型和端口type: ClusterIPport: 80
?
ingress: ? #ingress的相關(guān)配置enabled: falseclassName: ""annotations: {}# kubernetes.io/ingress.class: nginx# kubernetes.io/tls-acme: "true"hosts:- host: chart-example.localpaths:- path: /pathType: ImplementationSpecifictls: []#  - secretName: chart-example-tls# ?  hosts:# ? ?  - chart-example.local
?
resources: {} ?  #資源要求# We usually recommend not to specify default resources and to leave this as a conscious# choice for the user. This also increases chances charts run on environments with little# resources, such as Minikube. If you do want to specify resources, uncomment the following# lines, adjust them as necessary, and remove the curly braces after 'resources:'.# limits:# ? cpu: 100m# ? memory: 128Mi# requests:# ? cpu: 100m# ? memory: 128Mi
?
autoscaling:enabled: falseminReplicas: 1maxReplicas: 100targetCPUUtilizationPercentage: 80# targetMemoryUtilizationPercentage: 80
?
nodeSelector: {}
?
tolerations: []
?
affinity: {}

(2)配置后的values.yaml

[root@k8s-master helm]# cat nginx/values.yaml 
# Default values for nginx.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
?
replicaCount: 1
?
image:repository: nginxpullPolicy: IfNotPresent# Overrides the image tag whose default is the chart appVersion.tag: "1.17.3" ? #版本為1.17.3?
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
?
serviceAccount:# Specifies whether a service account should be createdcreate: true# Annotations to add to the service accountannotations: {}# The name of the service account to use.# If not set and create is true, a name is generated using the fullname templatename: ""
?
podAnnotations: {}
?
podSecurityContext: {}# fsGroup: 2000
?
securityContext: {}# capabilities:# ? drop:# ? - ALL# readOnlyRootFilesystem: true# runAsNonRoot: true# runAsUser: 1000
?
service:type: NodePort ?  #NodePort類型port: 80 ? ? #80端口
?
ingress:enabled: falseclassName: ""annotations: {}# kubernetes.io/ingress.class: nginx# kubernetes.io/tls-acme: "true"hosts:- host: chart-example.localpaths:- path: /pathType: ImplementationSpecifictls: []#  - secretName: chart-example-tls# ?  hosts:# ? ?  - chart-example.local
?
resources: {}# We usually recommend not to specify default resources and to leave this as a conscious# choice for the user. This also increases chances charts run on environments with little# resources, such as Minikube. If you do want to specify resources, uncomment the following# lines, adjust them as necessary, and remove the curly braces after 'resources:'.# limits:# ? cpu: 100m# ? memory: 128Mi# requests:# ? cpu: 100m# ? memory: 128Mi
?
autoscaling:enabled: falseminReplicas: 1maxReplicas: 100targetCPUUtilizationPercentage: 80# targetMemoryUtilizationPercentage: 80
?
nodeSelector: {}
?
tolerations: []
?
affinity: {}

(3)安裝命令

同k8s運(yùn)行pod差不多,都可以先測試一下但不實(shí)際運(yùn)行helm install --dry-run my-nginx nginx/,卸載將install替換為uninstall即可

[root@k8s-master helm]# helm install my-nginx nginx/
#指定好安裝后的名稱后要指定這個(gè)nginx模版目錄,安裝完成后還會(huì)提示你訪問方式
NAME: my-nginx
LAST DEPLOYED: Mon Mar 18 20:27:00 2024
NAMESPACE: default
STATUS: deployed
REVISION: 1
NOTES:
1. Get the application URL by running these commands:export NODE_PORT=$(kubectl get --namespace default -o jsonpath="{.spec.ports[0].nodePort}" services my-nginx)export NODE_IP=$(kubectl get nodes --namespace default -o jsonpath="{.items[0].status.addresses[0].address}")echo http://$NODE_IP:$NODE_PORT[root@k8s-master helm]# kubectl  get pods,svc
NAME ? ? ? ? ? ? ? ? ? ? ? ? ? READY ? STATUS ?  RESTARTS ? AGE
pod/my-nginx-9d774fb48-94wd8 ? 1/1 ? ? Running ? 0 ? ? ? ?  3m29s
?
NAME ? ? ? ? ? ? ? ? TYPE ? ? ?  CLUSTER-IP ? ?  EXTERNAL-IP ? PORT(S) ? ? ?  AGE
service/kubernetes ? ClusterIP ? 10.96.0.1 ? ? ? <none> ? ? ?  443/TCP ? ? ?  90m
service/my-nginx ? ? NodePort ?  10.97.171.192 ? <none> ? ? ?  80:30140/TCP ? 3m29s
[root@k8s-master helm]# curl http://192.168.2.151:30140
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>body {width: 35em;margin: 0 auto;font-family: Tahoma, Verdana, Arial, sans-serif;}
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
?
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
?
<p><em>Thank you for using nginx.</em></p>
</body>
</html>

二.版本更新和回滾問題

1.使用upgrade -f values.yaml或者命令行--set來設(shè)置

[root@k8s-master helm]# kubectl  describe pod my-nginx-9d774fb48-94wd8 | grep ImageImage: ? ? ? ?  nginx:1.17.5Image ID: ? ? ? docker.io/library/nginx@sha256:922c815aa4df050d4df476e92daed4231f466acc8ee90e0e774951b0fd7195a4
[root@k8s-master helm]# vim nginx/values.yaml 
[root@k8s-master helm]# vim nginx/values.yaml 
[root@k8s-master helm]# helm upgrade -f nginx/values.yaml my-nginx nginx/
Release "my-nginx" has been upgraded. Happy Helming!
NAME: my-nginx
LAST DEPLOYED: Mon Mar 18 20:35:40 2024
NAMESPACE: default
STATUS: deployed
REVISION: 2
NOTES:
1. Get the application URL by running these commands:export NODE_PORT=$(kubectl get --namespace default -o jsonpath="{.spec.ports[0].nodePort}" services my-nginx)export NODE_IP=$(kubectl get nodes --namespace default -o jsonpath="{.items[0].status.addresses[0].address}")echo http://$NODE_IP:$NODE_PORT
[root@k8s-master helm]# kubectl  get pods
NAME ? ? ? ? ? ? ? ? ? ? ?  READY ? STATUS ? ? ? ? ? ?  RESTARTS ? AGE
my-nginx-698cb48f59-v4pbb ? 0/1 ? ? ContainerCreating ? 0 ? ? ? ?  7s
my-nginx-9d774fb48-94wd8 ?  1/1 ? ? Running ? ? ? ? ? ? 0 ? ? ? ?  8m48s
[root@k8s-master helm]# kubectl  get pods
NAME ? ? ? ? ? ? ? ? ? ? ?  READY ? STATUS ?  RESTARTS ? AGE
my-nginx-698cb48f59-v4pbb ? 1/1 ? ? Running ? 0 ? ? ? ?  64s
[root@k8s-master helm]# kubectl  describe pod my-nginx-698cb48f59-v4pbb | grep ImageImage: ? ? ? ?  nginx:1.17.8Image ID: ? ? ? docker.io/library/nginx@sha256:380eb808e2a3b0dd954f92c1cae2f845e6558a15037efefcabc5b4e03d666d03

2.查看歷史版本并回滾

[root@k8s-master helm]# helm history my-nginx
REVISION    UPDATED ? ? ? ? ? ? ? ?     STATUS ?    CHART ? ?   APP VERSION DESCRIPTION ? ? 
1 ? ? ?     Mon Mar 18 20:27:00 2024    superseded  nginx-0.1.0 1.16.0 ? ?  Install complete
2 ? ? ?     Mon Mar 18 20:35:40 2024    deployed    nginx-0.1.0 1.16.0 ? ?  Upgrade complete
?
[root@k8s-master helm]# helm rollback my-nginx 1
Rollback was a success! Happy Helming!
[root@k8s-master helm]# kubectl get pods
NAME ? ? ? ? ? ? ? ? ? ? ? READY ? STATUS ?  RESTARTS ? AGE
my-nginx-9d774fb48-9pv7q ? 1/1 ? ? Running ? 0 ? ? ? ?  5s
[root@k8s-master helm]# kubectl  describe pods my-nginx-9d774fb48-9pv7q | grep ImageImage: ? ? ? ?  nginx:1.17.5Image ID: ? ? ? docker.io/library/nginx@sha256:922c815aa4df050d4df476e92daed4231f466acc8ee90e0e774951b0fd7195a4

三.helm模板內(nèi)管道和函數(shù)

1.defautl

也就是和管道符號(hào)配合,當(dāng)你values中的值未指定時(shí),就使用此默認(rèn)值

以nginx模版的port為例,將其設(shè)置為空,但設(shè)置了默認(rèn)值為80,創(chuàng)建過后仍然會(huì)暴露80端口

[root@k8s-master helm]# cat nginx/values.yaml | grep portport: 
#在deployment文件中引用了此變量的地方設(shè)置default
[root@k8s-master helm]# cat nginx/templates/deployment.yaml  | grep defaultimage: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"containerPort: {{ .Values.service.port | default 80 }} ? #這樣寫#在service文件中引用了此變量的地方設(shè)置default
[root@k8s-master helm]# cat nginx/templates/service.yaml | grep default- port: {{ .Values.service.port | default 80 }}
[root@k8s-master helm]# helm install nginx nginx/
[root@k8s-master helm]# kubectl get pods,svc
NAME ? ? ? ? ? ? ? ? ? ? ? ? READY ? STATUS ?  RESTARTS ? AGE
pod/nginx-6467995c7d-gt4g5 ? 1/1 ? ? Running ? 0 ? ? ? ?  8s
?
NAME ? ? ? ? ? ? ? ? TYPE ? ? ?  CLUSTER-IP ? ?  EXTERNAL-IP ? PORT(S) ? ? ?  AGE
service/kubernetes ? ClusterIP ? 10.96.0.1 ? ? ? <none> ? ? ?  443/TCP ? ? ?  113m
service/nginx ? ? ?  NodePort ?  10.106.164.22 ? <none> ? ? ?  80:32598/TCP ? 8s

2.quote

這個(gè)表示的是為某個(gè)變量設(shè)置后,無論設(shè)定的變量值是什么類型,都將其識(shí)別為字符串類型,書寫格式如下

{{ quote .Values.service.port }}

3.indent和nindent

indent表示在同一行變量值前設(shè)定多少個(gè)縮進(jìn)值,nindent表示換行后再在變量值前設(shè)置多少個(gè)縮進(jìn)值,書寫格式如下

{{ .Values.service.port | indent/nindent 10 }}

4.upper

將值都變?yōu)榇髮?#xff0c;格式如下

{{ upper .Values.service.port }}

5.title

將首字母設(shè)置為大寫,格式如下

{{ title .Values.service.port }}

6.toYaml

將一整個(gè)yaml塊都取值取過來,一般還需要陪著縮進(jìn)一起使用,格式如下

{{ toYaml .Values.service.port | indent/nindent 10 }}
http://www.risenshineclean.com/news/37878.html

相關(guān)文章:

  • 惠州有做網(wǎng)站的嗎免費(fèi)個(gè)人自助建站
  • 南昌專業(yè)做網(wǎng)站公司有哪些電腦優(yōu)化工具
  • 黃驊烈士網(wǎng)奇seo培訓(xùn)官網(wǎng)
  • 建設(shè)網(wǎng)站預(yù)算廣州seo營銷培訓(xùn)
  • 17網(wǎng)店貨源網(wǎng)seo綜合查詢系統(tǒng)
  • 深圳定制網(wǎng)站公司免費(fèi)seo關(guān)鍵詞優(yōu)化排名
  • 江門網(wǎng)站推廣軟件關(guān)鍵詞排名提高
  • 網(wǎng)頁設(shè)計(jì)配色時(shí)可以用關(guān)鍵詞是網(wǎng)站seo的核心工作
  • 云臺(tái)山旅游景區(qū)網(wǎng)站建設(shè)內(nèi)容業(yè)務(wù)推廣方式有哪些
  • wordpress source安卓優(yōu)化大師手機(jī)版下載
  • boostrop怎么做網(wǎng)站網(wǎng)絡(luò)推廣理實(shí)一體化軟件
  • 網(wǎng)站開發(fā)設(shè)計(jì)各部門職責(zé)寧德市疫情
  • 商標(biāo)注冊核名查詢系統(tǒng)成都百度快照優(yōu)化排名
  • 做電力 公司網(wǎng)站seo網(wǎng)絡(luò)推廣是什么意思
  • 公司網(wǎng)站注意事項(xiàng)產(chǎn)品推廣詞
  • 南昌網(wǎng)站建設(shè)基本流程上海網(wǎng)絡(luò)推廣公司
  • 移動(dòng)版網(wǎng)站怎么做如何自己創(chuàng)建一個(gè)網(wǎng)站
  • 12306網(wǎng)站為什么做那么差如何進(jìn)行線上推廣
  • 用.net做網(wǎng)站好 還是用php建站之星
  • 帶做網(wǎng)站天天外鏈官網(wǎng)
  • 成都sem優(yōu)化西seo優(yōu)化排名
  • 南京品牌網(wǎng)站設(shè)計(jì)免費(fèi)創(chuàng)建個(gè)人網(wǎng)站
  • wordpress全站靜態(tài)頁面百度網(wǎng)站排名怎么提高
  • 展示型裝飾網(wǎng)站模板網(wǎng)站排名快速提升
  • 騰訊云服務(wù)器用什么軟件做網(wǎng)站怎么從網(wǎng)上找國外客戶
  • 網(wǎng)站開發(fā)維護(hù)花費(fèi)seo關(guān)鍵詞分析表
  • 學(xué)院網(wǎng)站建設(shè)與管理辦法今日國家新聞
  • 抖音代運(yùn)營需要什么資質(zhì)東莞優(yōu)化怎么做seo
  • 建站網(wǎng)絡(luò)電商網(wǎng)站建設(shè)開發(fā)
  • 網(wǎng)站建設(shè)A系列套餐報(bào)價(jià)代寫文章多少錢