-
Notifications
You must be signed in to change notification settings - Fork 45
/
Kubernetes Networking
24 lines (22 loc) · 1.06 KB
/
Kubernetes Networking
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Kubernetes have advanced networking capabilities that allow Pods and Services to communicate inside the cluster's network and externally.
#Cluster IP
#Target Ports
#NodePort
#External IPs
#Load Balancer
#https://github.com/SonarSource/sonar-scanning-examples
kubectl apply -f clusterip.yaml
cat clusterip.yaml
kubectl get pods
kubectl get svc
#Target ports allows us to separate the port the service is available on from the port the application is listening on. TargetPort is the Port which the application is configured to listen on. Port is how the application will be accessed from the outside.
kubectl describe svc/webapp1-clusterip-svc
kubectl apply -f clusterip-target.yaml
kubectl get svc
kubectl describe svc/webapp1-clusterip-targetport-svc
export CLUSTER_IP=$(kubectl get services/webapp1-clusterip-targetport-svc -o go-template='{{(index .spec.clusterIP)}}')
echo CLUSTER_IP=$CLUSTER_IP
curl $CLUSTER_IP:8080
export CLUSTER_IP=$(kubectl get services/webapp1-clusterip-svc -o go-template='{{(index .spec.clusterIP)}}')
echo CLUSTER_IP=$CLUSTER_IP
curl $CLUSTER_IP:80