1. Create a deployment for the store-products service with four replicas. Log in to the Kube master node, Create the deployment with four replicas
user@ip-10-0-1-101:~$ vi store-products-deployment.yaml
Copy the content from https://github.com/cloudwwh/kubernetes/blob/master/store-products-deployment.yaml and make sure the intent are correct.
user@ip-10-0-1-101:~$ kubectl apply -f store-products-deployment.yaml
user@ip-10-0-1-101:~$ kubectl get pods -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE
busybox 1/1 Running 0 82m 10.244.1.2 ip-10-0-1-102 <none>
store-products-6c8b846d9d-9hvlg 0/1 ImagePullBackOff 0 3m 10.244.2.2 ip-10-0-1-103 <none>
store-products-6c8b846d9d-kxkn7 0/1 ImagePullBackOff 0 3m 10.244.2.3 ip-10-0-1-103 <none>
store-products-6c8b846d9d-mnbr9 0/1 ImagePullBackOff 0 3m 10.244.1.4 ip-10-0-1-102 <none>
store-products-6c8b846d9d-w6njw 0/1 ImagePullBackOff 0 3m 10.244.1.3 ip-10-0-1-102 <none>
user@ip-10-0-1-101:~$ kubectl get deployments
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
store-products 4 4 4 0 2m41s
2. Create a store-products service and verify that you can access it from the busybox testing pod
user@ip-10-0-1-101:~$ vi store-products-service.yaml
Copy the content from https://github.com/cloudwwh/kubernetes/blob/master/store-products-service.yaml and make sure the intent are correct.
user@ip-10-0-1-101:~$ kubectl apply -f store-products-service.yaml
user@ip-10-0-1-101:~$ kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 86m
store-products ClusterIP 10.106.110.146 <none> 80/TCP 8s
Create test pod busybox and test: kubectl exec busybox curl -s store-products