失效链接处理 |
cka2020试题及答案 PDF 下载
本站整理下载:
相关截图:
主要内容:
06 Task - 英文
Reconfigure the existing deployment front-end and add a port specifiction named http exposing port
80/tcp of the existing container nginx.
Create a new service named front-end-svc exposing the container prot http.
Configure the new service to also expose the individual Pods via a NodePort on the nodes on which they
are scheduled.
--------------------------------------------------------------------------------------------------------------------------------
kubectl get deploy front-end
kubectl edit deploy front-end -o yaml
#port specification named http
#service.yaml
apiVersion: v1
kind: Service
metadata:
name: front-end-svc
labels:
app: nginx
spec:
ports:
- port: 80
protocol: tcp
name: http
selector:
app: nginx
type: NodePort
#
kubectl create -f service.yaml
#
kubectl get svc
#或者一条命令搞定,注意会遗漏port specification named http
kubectl expose deployment front-end --name=front-end-svc --port=80 --tarport=80 --type=NodePort
07 Task - 英文
Create a new nginx Ingress resource as follows:
•Name: ping
•Namespace: ing-internal
•Exposing service hi on path /hi using service port 5678
The avaliability of service hi can be checked using the following command,which should return hi:
curl -kL /hi
--------------------------------------------------------------------------------------------------------------------------------
vi ingress.yaml
#
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ping
namespace: ing-internal
spec:
rules:
- http:
paths:
- path: /hi
pathType: Prefix
backend:
service:
name: hi
port:
number: 5678
#
kubectl create -f ingress.yaml
|