--- title: Kubectl expose # 簡報的名稱 tags: K8s # 簡報的標籤 --- # Kubectl expose > [name=李俊毅] > [time=Thu, Mar 19, 2020 6:57 PM] --- ## Agenda * 什麼是 Kubectl expose * Kubectl expose 語法 * Kubectl expose 範例 * 其他指令說明 --- ## 什麼是 Kubectl expose 將 Pod 對外暴露成為 Kubernetes Services --- ## Kubectl expose 語法 ``` kubectl expose (-f FILENAME | TYPE NAME) [--port=port] [--protocol=TCP|UDP] [--target-port=number-or-name] [--name=name] [--external-ip=external-ip-of-service] [--type=type] ``` --- ## Kubectl expose 範例 ---- ### 為 Deployment 的 redis 創建 Service ,並通過 Service 的 6379 端口轉發至容器 6379 端口上 ``` kubectl expose deploy redis --port=6379 --target-port=6379 ``` --- ## [其他指令說明](https://kubernetes.kansea.com/docs/user-guide/kubectl/kubectl_expose/)
×
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