happyso
study with happyso
happyso
전체 방문자
오늘
어제
  • 분류 전체보기 (302)
    • GIT (3)
    • 컴퓨터 기본 개념 (29)
    • 알고리즘 (125)
      • 알고리즘 문제 (115)
      • 알고리즘 개념 (10)
    • Go (2)
    • 클라우드 (54)
      • DevOps (4)
      • Kubernetes(쿠버네티스) (33)
      • AWS (6)
      • CKA (8)
    • 리눅스(Linux) (18)
      • 컨테이너(Container) (8)
    • Front (22)
      • JavaScript (2)
      • React (20)
    • Python (21)
      • Python 웹 크롤링 (11)
      • Django (7)
      • MachineLearning (3)
    • 데이터베이스 (6)
      • MariaDB (2)
      • MongoDB (4)
    • C언어 (5)
    • Trouble Shooting (2)
    • 네트워크 (8)
      • CCNA (5)
    • 보안 (1)

블로그 메뉴

  • 홈
  • 태그
  • 방명록

공지사항

인기 글

태그

  • edit
  • kubernetes
  • replace
  • apply
  • 18
  • Patch
  • 15

최근 댓글

최근 글

티스토리

hELLO · Designed By 정상우.
happyso

study with happyso

클라우드/CKA

[CKA] mock exam 01

2021. 12. 15. 23:56

[문제]

Create a service messaging-service to expose the messaging application within the cluster on port 6379.


Use imperative commands.

 
  • Service: messaging-service
  • Port: 6379
  • Type: ClusterIp
  • Use the right labels

[나의 풀이]

root@controlplane:~# kubectl create service clusterip messaging-service --tcp=6379
service/messaging-service created

 

[정답]

kubectl expose pod messaging --port=6379 --name messaging-service

 

 

[문제]

Create a static pod named static-busybox on the master node that uses the busybox image and the command sleep 1000

 

[정답]

kubectl run static-busybox --image=busybox --dry-run=client -o yaml > static-busybox.yaml
vi static-busybox.yaml

command: ["sleep", "1000"] 추가

apiVersion: v1
kind: Pod
metadata:
  name: static-busybox
spec:
  containers:
  - name: static-busybox
    image: busybox
    command: ["sleep", "1000"]

 

mv static_busybox.yaml /etc/kubernetes/manifests

 

 

[문제]

Expose the hr-web-app as service hr-web-app-service application on port 30082 on the nodes on the cluster.

The web application listens on port 8080.

  • Name: hr-web-app-service
  • Type: NodePort
  • Endpoints: 2
  • Port: 8080
  • NodePort: 30082
root@controlplane:~# kubectl expose deployment hr-web-app --type=NodePort --port=8080 --name=hr-web-app-service
service/hr-web-app-service exposed
root@controlplane:~# kubectl get svcNAME                 TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)          AGE
hr-web-app-service   NodePort    10.99.216.56     <none>        8080:30647/TCP   3s
kubernetes           ClusterIP   10.96.0.1        <none>        443/TCP          87m
messaging-service    ClusterIP   10.111.245.134   <none>        6379/TCP         27m

 

root@controlplane:~# kubectl edit svc hr-web-app-service 
// nodePort를 30082로 변경
apiVersion: v1
kind: Service
metadata:
  name: hr-web-app-service
  labels:
    app: hr-web-app
spec:
  type: NodePort
  selector:
    app: hr-web-app
  ports:
    - port: 8080
      nodePort: 30082
service/hr-web-app-service edited

 

[문제]

Use JSON PATH query to retrieve the osImages of all the nodes and store it in a file /opt/outputs/nodes_os_x43kj56.txt.

The osImages are under the nodeInfo section under status of each node.

 

[정답]

kubectl get nodes -o jsonpath='{.items[*].status.nodeInfo.osImage}' > /opt/outputs/nodes_os_x43kj56.txt

'클라우드 > CKA' 카테고리의 다른 글

[CKA] Ligtning Lab  (0) 2022.01.02
[CKA] mock exam 03  (0) 2021.12.26
[CKA] mock exam 02  (0) 2021.12.26
[network] dns  (0) 2021.10.16
[network] switching routing  (0) 2021.10.16
    '클라우드/CKA' 카테고리의 다른 글
    • [CKA] mock exam 03
    • [CKA] mock exam 02
    • [network] dns
    • [network] switching routing
    happyso
    happyso

    티스토리툴바