You are viewing an old version of this page. View the current version.
Compare with Current View Page History
« Previous Version 31 Next »
목차
NodePort
ClusterIP (default)
LoadBalancer
apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deploy labels: app: myapp-deploy type: front-end spec: template: metadata: name: nginx labels: app: myapp type: front-end spec: containers: - name: nginx image: nginx:1.14.2 ports: - containerPort: 80 selector: matchLabels: type: front-end replicas: 3
apiVersion: v1 kind: Service metadata: labels: app: myapp-svc type: front-end name: nginx-svc spec: ports: - port: 80 protocol: TCP targetPort: 80 selector: type: front-end
sansae@sansaeAir15m2 k8s-lab-workspace % k apply -f nginx-svc.yaml service/nginx-svc created sansae@sansaeAir15m2 k8s-lab-workspace % k get svc NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ClusterIP 10.0.0.1 <none> 443/TCP 23h nginx-svc ClusterIP 10.0.133.111 <none> 80/TCP 5s sansae@sansaeAir15m2 k8s-lab-workspace % k describe svc nginx-svc Name: nginx-svc Namespace: default Labels: app=myapp-svc type=front-end Annotations: <none> Selector: type=front-end Type: ClusterIP IP Family Policy: SingleStack IP Families: IPv4 IP: 10.0.133.111 IPs: 10.0.133.111 Port: <unset> 80/TCP TargetPort: 80/TCP Endpoints: 10.244.0.75:80,10.244.0.76:80,10.244.0.77:80 Session Affinity: None Events: <none>
sansae@sansaeAir15m2 k8s-lab-workspace % k get svc NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ClusterIP 10.0.0.1 <none> 443/TCP 24h nginx-svc ClusterIP 10.0.133.111 <none> 80/TCP 61m sansae@sansaeAir15m2 k8s-lab-workspace % k run util --image=amouat/network-utils --command sleep 3600 pod/util created sansae@sansaeAir15m2 k8s-lab-workspace % k exec -it util -- bash root@util:/# curl 10.0.133.111 <!DOCTYPE html> <html> <head> <title>Welcome to nginx!</title>
Single Pod on Single Node
Multi Pod on Single Node
Multi Pod on Multi Node