--- title: Service # 簡報的名稱 tags: K8s # 簡報的標籤 --- # Service > [name=李俊毅] > [time=Wed, Feb 5, 2020 1:02 PM] --- ## Agenda * 介紹 * 範例 * 常用的CLI --- ## 介紹 Service用於將一個Pod顯示為一個服務,在kubernetes中,Pod的IP地址會因Pod的重啟而變化,並不建議直接拿Pod的IP使用。 Service為一組Pod提供一個統一的入口,並為它們提供負載均衡和自動服務發現。 --- ## 範例 ---- hello-world-service.yaml ``` apiVersion: v1 kind: Service metadata: name: hello-world spec: selector: app.kubernetes.io/name: load-balancer-example ports: - port: 8080 targetPort: 8080 ``` --- ## 常用的CLI ---- ### 查詢 services ---- ``` kubectl get svc ``` 
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up