Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Service

  1. Apply pods

    kubectl apply -f pod-my-app.yaml
    kubectl apply -f pod-your-app.yaml
    
  2. Show labels

    kubectl get po --show-labels
    
  3. Filter pods by label

    kubectl get po --selector app=MyApp
    kubectl get po --selector app=YourApp
    
  4. Create service.

    kubectl apply -f service-my-service.yaml
    
    kubectl get service
    

    Check Endpoints

    kubectl get endpoints
    

    You can see IP address with port 80.

    This IP is the IP address of pod my-app

    kubectl get pod --selector app=MyApp -o wide
    
  5. Access to the service

    port-forward:

    kubectl port-forward svc/my-app 8080:80
    

    logs

    kubectl logs my-app -f
    

    Open localhost:8080 on your browser.

    -> You can see the nginx page.

  6. Delete resources.

    kubectl delete -f .