kubectl port-forward pod/nginx-deployment-66b6c48dd5-nqtdg 8080:80
# localhost:8080
kubectl delete deployment nginx-deployment
$ kubectl apply -f 2.yaml
$ kubectl get all
$ kubectl expose deployment hello-world --type=LoadBalancer
$ kubectl get service
or
$ kubectl get svc
$ curl http://<loadbalancer-ingress-ip>:<target-port>
$ kubectl delete deployment hello-world
$ kubectl delete svc hello-world
The solution of the yaml is here 4.yaml.
$ kubectl apply -f 4.yaml
$ kubectl port-forward services/nginx-service 8080:80
$ kubectl delete -f 4.yaml
The solution of the yaml is here 5.yaml.
$ kubectl apply -f 5.yaml
$ kubectl delete -f 5.yaml
You can find the solution yaml here 6.yaml.
$ kubectl create configmap cm --from-file=7.txt
$ kubectl create configmap cm --from-literal=city=London
$ kubectl apply -f 8.yaml