Files
alfred-preferences/Alfred.alfredpreferences/snippets/Kubernetes/Service YAML 範本 [7412540F-364A-4F5C-B3EA-9581FF4CAB14].json
2026-03-26 09:22:38 +08:00

8 lines
1.1 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{
"alfredsnippet" : {
"snippet" : "# --- 3. 服務 (Service) ---\napiVersion: v1\nkind: Service\nmetadata:\n name: my-app-service # <--- Service 名稱 (叢集內可用此名稱當 DNS 連結)\n namespace: default # <--- 需與 Deployment 同 Namespace\n labels:\n app: my-app\nspec:\n selector:\n app: my-app # <--- 關鍵:必須跟 Deployment 的 labels 完全一樣,才能找到 Pod\n \n # [類型選擇]\n # ClusterIP: 預設值,僅限叢集內部存取 (若要搭配 Ingress 請選這個)\n # NodePort: 會開一個 port (30000-32767) 讓外部用 NodeIP:Port 連線\n type: ClusterIP # <--- 依需求修改 (ClusterIP \/ NodePort)\n\n ports:\n - protocol: TCP\n name: http\n port: 80 # <--- Service 本身對外暴露的 Port\n targetPort: 80 # <--- 你的容器 (Container) 實際在聽的 Port\n # nodePort: 30080 # <--- 若 type 是 NodePort可在此指定固定 Port",
"uid" : "7412540F-364A-4F5C-B3EA-9581FF4CAB14",
"name" : "Service YAML 範本",
"keyword" : ""
}
}