service objects Flashcards

CKA cert in 26 days

1
Q

a ______ is used to set up networking in our kube cluster. Making it easily accessible externally

websites. gui. people outside need to access webserver.
publicly.

A

SERVICE OBJECT

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

4 types of services

A

CLUSTERIP
NODEPORT
LOADBALANCER
INGRESS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

which ONE of the 4 services SHOULD ONLY BE USED FOR DEV ENVIRONMENTS?
is NOT GOOD FOR PRODUCTION ENVIORNMENTS

A

NODEPORT

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q
apiVersion: v1
kind: Service
metadata:
  name: svc-nodeport-httpd
spec:
  type: NodePort
  ports:
  - port: 3050 

WHAT IS -port: 3050

A

Used by other pods so they can access the assets in container. from another pod, you can connect to this specific pod on PORT 3050

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q
apiVersion: v1
kind: Service
metadata:
  name: svc-nodeport-httpd
spec:
  type: NodePort
  ports:
  - port: 3050
    targetPort: 80 

WHAT IS -targetPort: 80

A

port number the pods primary container is listening on. Needs to mirror containerport setting as defined in the object config file (yaml file that created the pod)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q
apiVersion: v1
kind: Service
metadata:
  name: svc-nodeport-httpd
spec:
  type: NodePort
  ports:
  - port: 3050
    targetPort: 80
    nodePort: 31000 

WHAT IS nodePort 30000-32767

A

nodePort will always range between 30000-32767

  • kube-proxy component listens on this port for the worker node.
  • to access container from webbrowser youd need to use this port.
  • ^^^ the drawback to using nodeport service type
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q
apiVersion: v1
kind: Service
metadata:
  name: svc-nodeport-httpd
spec:
  type: NodePort
  ports:
  - port: 3050
    targetPort: 80
    nodePort: 31000
  selector:
    app: apache_webserver
A

it will forward traffic to object that has

‘app: apache_webserver’ as a metadata in yml file.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

COMMAND to CREATE a SERVICE OBJECT with :

svc-nodeport.yml

A

kubectl apply -f configs/svc-nordeport.yml

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

VIEW ALL OBJECTS COMMAND

A

kubectl get all -o wide

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

if the minikube ip is 192.168.99.107 and the nodeport is 31000.

how would you run the CURL COMMAND on to TEST THE ENDPOINT

A

curl http://192.168.99.100:31000

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

another way to run curl command to TEST THE ENDPOINT
is to run:
$ minikube service svc-nodeport-httpd –url

to show the IP and then…

A

curl $(minikube service svc-nodeport-httpd –url)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

DELETE ALL OBJECTS

A

kubectl delete all -all

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

DELETE WITH GRACEPERIOD

A

kubectl delete -f ./configs –grace-period=2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly