k8s commands 03

2021. 10. 26. 23:20·Programming

kubectl run nginx-pod --image=nginx:alpine

kubectl run redis --image=redis:alpine --dry-run=client -o=yaml > redis-pod.yaml

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

kubectl create deployment webapp --image=nginx --replicas=3

kubectl run custom-nginx --image=nginx --port=8080

kubectl create deployment redis-deploy --image redis --namespace dev-ns --replicas=2

kubectl run httpd --image=httpd:alpine --port=80 --expose

 

kubectl run nginx --image=nginx

kubectl run nginx --image=nginx --dry-run=client -o yaml

kubectl create deployment --image=nginx nginx

kubectl create deployment --image=nginx nginx --dry-run=client -o yaml

kubectl create deployment nginx --image=nginx --replicas=4

kubectl scale deployment nginx --replicas=4

kubectl create deployment nginx --image=nginx --dry-run=client -o yaml > nginx-deployment.yaml

 

Create a Service named redis-service of type ClusterIP to expose pod redis on port 6379

kubeclt expose pod redis --port=6379 --name redis-service --dry-run=client -o yaml

(THis will automatically use the pod's labels as selectors)

 

kubectl create service clusterip redis --tcp=6379:6379 --dry-run=client -o yaml

(This will not use the pods labels as selectors, instead it will assume selectors as app=redis. You cannot pass in selectors as an option. So it does not work very well if your pod has a differenct label set. So generate the file and modify the selectors before creating the service)

 

Create a Service name nginx of type NodePort to expose pod nginx's port 80 on port 30080 on the nodes

kubectl expose pod nginx --type=-NodePort --port=80 --name=nginx-service --dry-run=client o yaml

(This will automatically use the pod's labels as selectors, but cannot specify the node port)

 

kubectl create service nodeport nginx --tcp=80:80 --node-port=30080 --dry-run=client o yaml

(This will not use the pods labels as selectors)

'Programming' 카테고리의 다른 글

macOS Monterey의 5000번 포트  (0) 2021.11.04
k8s commands 04  (1) 2021.10.31
k8s commands 02  (0) 2021.10.25
k8s commands 01  (0) 2021.10.23
Spring Batch Test 클래스 설정 방법  (1) 2021.10.07
'Programming' 카테고리의 다른 글
  • macOS Monterey의 5000번 포트
  • k8s commands 04
  • k8s commands 02
  • k8s commands 01
Doljae
Doljae
  • Doljae
    Zero to Hero
    Doljae
  • 전체
    오늘
    어제
    • 분류 전체보기 (349)
      • Programming (54)
      • Algorithm (161)
      • Review (102)
      • Career (8)
      • Diary (18)
      • Shorts (4)
      • Temp (2)
  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
    • 글 쓰기
    • 관리
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    공채
    PYTHON
    백준
    컨퍼런스
    나는리뷰어다
    코딩테스트
    면접
    인프콘
    sql튜닝
    AI
    BOJ
    java
    db
    jpa
    2023
    2021
    mysql
    프로그래머스
    leetcode
    코딩
    2022
    나는 리뷰어다
    개발자
    ChatGPT
    sql
    한빛미디어
    회고
    database
    라인
    line
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.4
Doljae
k8s commands 03
상단으로

티스토리툴바