Networking Flashcards

1
Q

Without any service is it possible for two pods to communicate?

A

Yes, two pods can communicate with each other by using their ip addresses

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

What command creates a service of type cluster ip?

A

kubectl create service clusterip a-service-name –tcp (port):(targetPort)

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

What command creates a deployment and a service together?

A

kubectl run a-deployment-name –image an-image-name –port (port) –expose

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

How do you expose a preexisting deployment?

A

kubectl expose deployment a-deployment-name –port (port) –target-port (targetport)

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

What is an ingress?

A

An API object that provides routing rules to manage external users’ access to the services in a Kubernetes cluster

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

How would you deploy an ingress with rule of type prefix that sets a host to cla.oreilly.com and a target service echoserver:80?

A

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: incoming
namespace: external
annotations:
kubernetes.io/ingress.class: “nginx”
spec:
rules:
- host: cka.oreilly.com
http:
paths:
- backend:
service:
name: echoserver
port:
number: 80
path: /
pathType: Prefix

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

How would you deploy an ingress with rule of type prefix that sets a host to cla.oreilly.com and a target service echoserver:80?

A

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: incoming
namespace: external
annotations:
kubernetes.io/ingress.class: “nginx”
spec:
rules:
- host: cka.oreilly.com
http:
paths:
- backend:
service:
name: echoserver
port:
number: 80
path: /
pathType: Prefix

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

Why is it important to annotate an nginx ingress with kubernetes.io/ingress.class: “nginx”?

A

To ensure the nginx controller picks up the ingress resource

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