Step 4: Deploy Application on Initialized Container
Last updated
Last updated
Address
VNG CorporationStep 1: initialize the Deployment file - in this case, use the YANL . file
1.myapp-deploy.yaml
apiVersion: apps/v1 kind: Deployment metadata:
# name of deployment name: deployapp
spec:
# number of PODs generated replicas: 3
# set up deploy-managed PODs, which are PODs labeled "app=deployapp" selector: matchLabels: app: deployapp
# Define POD template, when needed Deploy uses this template to create Pod
template: metadata: name: podapp labels: app: deployapp spec: containers: name: node image: ichte/swarmtest:node resources: limits: memory: "128Mi" cpu: "100m" ports: containerPort: 8085
Execute the following command to deploy:
kubectl apply -f 1.myapp-deploy.yaml
When the Deployment is created, its name is deployapp, which can be checked with the command:
kubectl get deploy -o wide
This deploy creates a ReplicasSet and manages it, type the following command to display the ReplicaSet
kubectl get rs -o wide
In turn, the Deploy-managed ReplicaSet manages (creates, deletes) the Pods, to view the Pods.
kubeclt get po -o wide
# Or filter the whole label
kubectl get po -l "app=deployapp" -o wide
Example: Case deploy APP echo1:
Check the deployment:
Step 2: Expose Services Just deployed to Public Thực hiện apply cấu hinh len Container: Test access from outside the Internet to Echo1 Service with port 30309
That's it, I've finished the application and Expose to the internet