K8S, Services Command

개발 및 관리/클라우드 2023. 8. 29. 08:59 posted by HighLighter
반응형

service-definition.yml

apiVersion: v1
kind: Service
metadata:
  name: back-end

spec:
  type: ClusterIP
  ports:
   - targetPort: 80
     port: 80

  selector:
    app: myapp
    type: back-end

------------------------------------------------------------------------------------------

kubectl create -f 
service-definition.yml
kubectl get services

------------------------------------------------------------------------------------------

Services-LoandBalancer


apiVersion: v1
kind: Service
metadata:
  name: myapp-service

spec:
  type: LoadBalancer
  ports:
   - targetPort: 80
     port: 80
     nodePort: 30008

----------------------------------------------------------------------------------------------

apiVersion: v1
kind: Service
metadata:
  name: webapp-service
spec:
  type: NodePort
  ports:
   - targetPort: 8080
     port: 8080
     nodePort: 30080
  selector:
    name: simple-webapp

kubectl create -f service-definition-1.yaml

----------------------------------------------------------------------------------------------

kubectl get service
kubectl get svc
kubectl describe svc kubernetes
kubectl describe deploy
kubectl describe deploy simple-webapp-deployment

----------------------------------------------------------------------------------------------

반응형