上一篇筆記介紹如何安裝 Helm, 這一篇筆記將介紹如何簡單地用 Helm 部署應用程式.
# values.yaml
replicaCount: 3
wishlistImage:
repository: karthequian/wishlist
tag: "1.0"
pullPolicy: IfNotPresent
authImage:
repository: karthequian/wishlist-auth
tag: "1.0"
pullPolicy: IfNotPresent
catalogImage:
repository: karthequian/wishlist-catalog
tag: "1.0"
pullPolicy: IfNotPresent
service:
type: NodePort
wishlistPortName: wishlist-port
wishlistPortValue: 8080
catalogPortName: catalog-port
catalogPortValue: 8082
authPortName: auth-port
authPortValue: 8081
port: 80
helm install
-n wishlist-chart -f .\values.yaml 安裝 ChartPS C:\k8s\helm\wishlist> helm install -n wishlist-chart -f .\values.yaml .
NAME: wishlist-chart
LAST DEPLOYED: Wed Oct 24 13:51:54 2018
NAMESPACE: default
STATUS: DEPLOYED
RESOURCES:
==> v1/Service
NAME AGE
wishlist-chart 0s
==> v1/Deployment
wishlist-chart 0s
==> v1/Pod(related)
NAME READY STATUS RESTARTS AGE
wishlist-chart-69796586bb-2st6r 0/3 Pending 0 0s
wishlist-chart-69796586bb-6ntlf 0/3 Pending 0 0s
wishlist-chart-69796586bb-8jlzr 0/3 Pending 0 0s
NOTES:
1. Get the application URL by running these commands:
export NODE_PORT=$(kubectl get --namespace default -o jsonpath="{.spec.ports[0].nodePort}" services wishlist-chart)
export NODE_IP=$(kubectl get nodes --namespace default -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
PS C:\k8s\helm\wishlist> kubectl get deployments
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
aspnetapp-deployment 2 2 2 2 13d
aspnetapp-interactive-delopyment 3 3 3 3 13d
wishlist-chart 3 3 3 3 2m
wishlist-deployment 3 3 3 3 12h
helm ls
, 列出已經部署的 helm chartPS C:\k8s\helm\wishlist> helm ls
NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
wishlist-chart 1 Wed Oct 24 13:51:54 2018 DEPLOYED wishlist-0.1.0 1.0 default
PS C:\k8s\helm\wishlist> kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 14d
wishlist-chart NodePort 10.105.185.182 <none> 8080:31584/TCP,8082:31679/TCP,8081:30676/TCP 4m
wishlist-service NodePort 10.97.103.43 <none> 8080:30480/TCP,8081:32207/TCP,8082:32379/TCP 12h
是不是很簡單就將應用程式部署完成了?