docker,k8s
kubectl 명령어 공부
limdef
2021. 2. 22. 14:05
pod의 특정 shell에 접근
kubectl exec -it <pod의 name> -- /bin/bash
kubeclt exec -it <pod name> -- bash
-- ex
kubectl exec -it <pod name> -- redis-cli
nginx 컨트롤러의 파드의 shell의 접근
kubectl get pods -n ingress-nginx // 으로 이름 확인후
kubectl -n ingress-nginx exec -it ingress-nginx-controller-zd5hr /bin/bash
인그레스 상세
kubectl describe ingress mark-lim-helloapp
아래와 같이 인그레스 설정시
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: mark-lim-helloapp
labels:
app: mark-lim-helloapp
annotations:
nginx.ingress.kubernetes.io/ssl-redirect: "false"
nginx.org/proxy-connect-timeout: "300s"
nginx.org/proxy-read-timeout: "300s"
nginx.ingress.kubernetes.io/configuration-snippet: |
if ($scheme = https) {
add_header Strict-Transport-Security "max-age=0;";
}
spec:
tls:
- hosts:
- foo.bar.com
rules:
- host: foo.bar.com
http:
paths:
- path: /
backend:
serviceName: mark-lim-helloapp
servicePort: 8080
인그레스에 설정된 호스트와 패스 백엔드를 볼수 있다.
Name: mark-lim-helloapp
Namespace: default
Address: 10.202.106.73
Default backend: default-http-backend:80 (<error: endpoints "default-http-backend" not found>)
Rules:
Host Path Backends
---- ---- --------
foo.bar.com
/ mark-lim-helloapp:8080 (10.240.0.165:8080,10.240.0.189:8080,10.240.0.249:8080)
Annotations: nginx.ingress.kubernetes.io/configuration-snippet:
if ($scheme = https) {
add_header Strict-Transport-Security "max-age=0;";
}
nginx.ingress.kubernetes.io/ssl-redirect: false
nginx.org/proxy-connect-timeout: 300s
nginx.org/proxy-read-timeout: 300s
pod의 로그 확인
kubectl logs -f <pod name>