跳到主要內容

有趣的Google container-vm

研究Google在GCE執行datalab的範例中,發現了個頗有趣的事情... 不久前Google針對Optimized Container出了一個container-vm,雖然目前已經預計要deprecate這個image,不過在datalab執行於GCE的範例中M還是使用這個image來執行...
有趣的地方是,datalab-service.yaml是一個k8s的pod描述檔... 下面是instance執行的gcloud腳本:
gcloud compute instances create "instance-name" \
  --project "project-id" \
  --zone "zone" \
  --network "datalab-network" \
  --image-family "container-vm" \
  --image-project "google-containers" \
  --metadata-from-file "google-container-manifest=datalab-server.yaml" \
  --machine-type "n1-highmem-2" \
  --scopes "cloud-platform"
打開datalab-server.yaml檢視,內容如下:
apiVersion: v1
kind: Pod
metadata:
  name: 'datalab-server'
spec:
  containers:
    - name: datalab
      image: gcr.io/cloud-datalab/datalab:local
      command: ['/datalab/run.sh']
      imagePullPolicy: Always
      ports:
        - containerPort: 8080
          hostPort: 8080
          hostIP: 127.0.0.1
      env:
        - name: DATALAB_ENV
          value: GCE
      volumeMounts:
        - name: home
          mountPath: /content
    - name: logger
      image: gcr.io/google_containers/fluentd-gcp:1.18
      env:
        - name: FLUENTD_ARGS
          value: -q
      volumeMounts:
        - name: varlog
          mountPath: /var/log
        - name: varlibdockercontainers
          mountPath: /var/lib/docker/containers
          readOnly: true
  volumes:
    - name: home
      hostPath:
        path: /root
    - name: varlog
      hostPath:
        path: /var/log
    - name: varlibdockercontainers
      hostPath:
        path: /var/lib/docker/containers
這本身是個k8s pod的描述檔,本來需要透過kubernetes cluster才能夠執行,但是卻可以在container-vm中執行... 檢查了一下,原來是透過kubelet來執行... 研究一下kubelet執行container的方式,目前找到可以在/etc/kubernetes/manifests下面直接放置yaml檔案,然後重啟kubelet(/etc/init.d/kubelet restart)即可。

Reference

留言

  1. My TV (Hands Free) Videos on YouTube
    youtube.com Videos on YouTube | Videos on YouTube. Youtube best youtube to mp3 converter online is the largest streaming service to live stream the sport of soccer, Aug 8, 2019

    回覆刪除

張貼留言

這個網誌中的熱門文章

透過Google Apps Script結合Google Form做即時郵件通知

體驗過Google Apps Script的功能後,也發現他結合GmailApps的模組 GmailApps的應用可以用在表單填寫完成後,做發信的通知 例如您開立了一個訂購的表單,為了要在第一時間通知商家有訂單進入 就可以直接呼叫Gmail做發信的通知,讓手持Smart Phone的我們可以很快的知道生意上門了! 下面規劃三個function,其中: onCommit():為form commit時候觸發的function,需要掛載於form commit trigger上 jsonArrToTable():目的將json array解析成為一個Table getLastRowTable():目的將整個table的回傳過濾為剩下第一筆(表頭,含有Form的欄位說明)與最後一筆(原則上就是剛剛送出的那一筆表單) 完整程式碼如下: function onCommit(){   var sheet = SpreadsheetApp.getActiveSheet();   var rows = sheet.getDataRange();   var numRows = rows.getNumRows();   var values = rows.getValues();   var content = getLastRowTable(values);   var htmlBody = "Hi Admin: <br/><br/>有訂單拉,檢查一下吧! <br/><br/>" + content + '<br/><br/>Send by Google Apps';   GmailApp.sendEmail(     " your-email-address@gmail.com ",      "Order Confirm Notice",      htmlBody,      {from: ' from-email-...

Share a chrome plugin for manage google cloud platform

好玩意兒報報.... 同事的新作,把Google Project List在Chrome Plugin中! 對一次管理多個專案的人來說,真得超方便的拉! 下載: https://chrome.google.com/webstore/detail/gdclauncher/bicgkglnnilldakpenngnblekooejnpg 使用說明: 1. Use browser url bar to quick search: Type "gdcl" in browser Press "TAB" to start search Type the project id key word then select the search result... 2. Using quick launch bar... You can search by keyword or click project name to go to the project or gae link to go to gae or go to billing page....

Cloud Monitor嚐鮮

GCP上,我們非常想要的一個功能,終於問世.... Cloud Monitor來了!