SlideShare a Scribd company logo
© 2021 Kasten, Inc.
Proxies, Pods and Ports
Aaron Alpar
Member of Technical Staff
Kasten by Veeam
© 2021 Kasten, Inc.
1. Introduction
2. Setup - the .yaml files
3. Kubernetes API Proxies
4. Using kubectl's --raw opton
5. Port forwarding with kubectl port-forward-ing
6. kubectl logs and kubectl attach
Agenda
© 2021 Kasten, Inc.
Proxies, Pods and Ports
Pods have various access points exposed via kubectl
● As proxy through the API server
● Through port-forwarding
● Through stdin, stdout and stderr
© 2021 Kasten, Inc.
The Deployment
$ cat deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
namespace: demo-1
spec:
selector:
matchLabels:
app: nginx
replicas: 1
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
© 2021 Kasten, Inc.
The Service
$ cat service.yaml
apiVersion: v1
kind: Service
metadata:
name: nginx-service
namespace: demo-1
labels:
run: nginx
spec:
selector:
app: nginx
ports:
- name: http
protocol: TCP
port: 80
© 2021 Kasten, Inc.
API Server Proxy
● Direct access to API server
● Forwards HTTP connections from local port to API server
● Forwarded connections will be amended with authentication state
● Similar to using --raw
© 2021 Kasten, Inc.
API Server Proxy
$ kubectl proxy
Starting to serve on 127.0.0.1:8001
$ curl http://localhost:8001/
{
"paths": [
"/.well-known/openid-configuration",
"/api",
"/api/v1",
"/apis",
"/apis/",
"/apis/admissionregistration.k8s.io",
"/apis/admissionregistration.k8s.io/v1",
...
© 2021 Kasten, Inc.
API Server Proxy
$ kubectl get namespaces
NAME STATUS AGE
default Active 22h
demo-1 Active 3m46s
kube-node-lease Active 22h
$ curl http://localhost:8001/api/v1/namespaces
{
"kind": "NamespaceList",
"apiVersion": "v1",
"metadata": {
"resourceVersion": "2812175"
},
"items": [
{
"metadata": {
"name": "default",
...
© 2021 Kasten, Inc.
API Server Proxy
$ kubectl get pods -n demo-1 nginx-deployment-66b6c48dd5-wst5h
NAME READY STATUS RESTARTS AGE
nginx-deployment-66b6c48dd5-wst5h 1/1 Running 0 32m
$ curl
http://localhost:8001/api/v1/namespaces/demo-1/pods/nginx-deployment-66b6c48dd5-wst5h
{
"kind": "Pod",
"apiVersion": "v1",
"metadata": {
"name": "nginx-deployment-66b6c48dd5-wst5h",
...
© 2021 Kasten, Inc.
API Server Proxy
Access to HTTP and HTTPS services in
● Services
● Pods
© 2021 Kasten, Inc.
API Server Proxy: Service Ports
$ curl http://localhost:8001/api/v1/namespaces/demo-1/services/nginx-service:http/proxy/
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
...
© 2021 Kasten, Inc.
API Server Proxy: Service Ports
$ curl http://localhost:8001/api/v1/namespaces/demo-1/services/nginx-service:http/proxy/
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
...
© 2021 Kasten, Inc.
API Server Proxy: Service Ports
$ curl http://localhost:8001/api/v1/namespaces/demo-1/services/nginx-service:http/proxy/
...
$ cat service.yaml
...
selector:
app: nginx
ports:
- name: http
protocol: TCP
port: 80
...
© 2021 Kasten, Inc.
API Server Proxy: Service Ports
Proxy URL form for a Service port
/api/v1/namespaces/namespace_name/services/[https:]service_name[:port_name]/proxy
© 2021 Kasten, Inc.
API Server Proxy: Pod Ports
$ curl 
http://localhost:8001/api/v1/namespaces/demo-1/pods/nginx-deployment-66b6c48dd5-t8446:80/proxy/
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
...
© 2021 Kasten, Inc.
API Server Proxy: Pod Ports
$ curl 
http://localhost:8001/api/v1/namespaces/demo-1/pods/nginx-deployment-66b6c48dd5-t8446:80/p
roxy/
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
...
© 2021 Kasten, Inc.
API Server Proxy: Pod Ports
$ curl http://localhost:8001/api/v1/namespaces/demo-1/pods/nginx-deployment-66b6c48dd5-t8446:80/proxy/
...
$ kubectl get pod -n demo-1 nginx-deployment-66b6c48dd5-t8446 -o yaml
...
containers:
- image: nginx:1.14.2
name: nginx
ports:
- containerPort: 80
protocol: TCP
...
© 2021 Kasten, Inc.
API Server Proxy: Pod Ports
Proxy URL form for a Pod port
/api/v1/namespaces/namespace_name/pods/[https:]pod_name[:port_number]/proxy
© 2021 Kasten, Inc.
API Server Proxy
● kubectl proxy provides access to API server HTTPS endpoint
● Can be used to access service and pod endpoints
● Useful for debugging
© 2021 Kasten, Inc.
kubectl -v9
$ kubectl -v9 get pods -A
I1213 08:00:16.355063 98152 loader.go:372] Config loaded from file:
/Users/aalpar/.kube/config
I1213 08:00:16.360303 98152 round_trippers.go:435] curl -k -v -XGET -H "Accept:
application/json;as=Table;v=v1;g=meta.k8s.io,application/json;as=Table;v=v1beta1;g=meta.k8
s.io,application/json" -H "User-Agent: kubectl/v1.21.5 (darwin/amd64) kubernetes/aea7bba"
'https://127.0.0.1:64926/api/v1/pods?limit=500'
I1213 08:00:16.371606 98152 round_trippers.go:454] GET
https://127.0.0.1:64926/api/v1/pods?limit=500 200 OK in 11 milliseconds
...
© 2021 Kasten, Inc.
kubectl -v9
$ kubectl -v9 get pods -A
I1213 08:00:16.355063 98152 loader.go:372] Config loaded from file:
/Users/aalpar/.kube/config
I1213 08:00:16.360303 98152 round_trippers.go:435] curl -k -v -XGET -H "Accept:
application/json;as=Table;v=v1;g=meta.k8s.io,application/json;as=Table;v=v1beta1;g=meta.k8
s.io,application/json" -H "User-Agent: kubectl/v1.21.5 (darwin/amd64) kubernetes/aea7bba"
'https://127.0.0.1:64926/api/v1/pods?limit=500'
I1213 08:00:16.371606 98152 round_trippers.go:454] GET
https://127.0.0.1:64926/api/v1/pods?limit=500 200 OK in 11 milliseconds
...
© 2021 Kasten, Inc.
kubectl -v9
● Non truncated kubectl debugging output
● Useful for getting curl versions of kubectl commands
● curl commands can be used in conjunction with kubectl proxy
● Values less than 9 provide less output
© 2021 Kasten, Inc.
Raw Option
● kubectl --raw used to submit URL to the API server
● Can be used with get, create, delete
© 2021 Kasten, Inc.
Raw Option
$ kubectl get --raw /api/v1/namespaces | jq
{
"kind": "NamespaceList",
"apiVersion": "v1",
"metadata": {
"resourceVersion": "2812175"
},
"items": [
{
"metadata": {
"name": "default",
...
© 2021 Kasten, Inc.
Raw Option
$ kubectl get --raw /api/v1/namespaces/demo-1/services/nginx-service | jq
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "nginx-service",
"namespace": "demo-1",
"uid": "8fa61327-0158-4d1c-a48a-2364150545d8",
"resourceVersion": "9485",
"creationTimestamp": "2021-12-12T17:42:25Z",
"labels": {
...
© 2021 Kasten, Inc.
The Service as JSON
$ cat service.json
{
"apiVersion": "v1",
"kind": "Service",
"metadata": {
"name": "nginx-service",
"namespace": "demo-1",
"labels": {
"run": "nginx"
}
},
"spec": {
"selector": {
"app": "nginx"
},
"ports": [
{
"name": "http",
"protocol": "TCP",
"port": 80
}
]
}
}
© 2021 Kasten, Inc.
Raw Option
$ kubectl delete --raw /api/v1/namespaces/demo-1/services/nginx-service
{"kind":"Status","apiVersion":"v1","metadata":{},"status":"Success","details":{"name":"nginx-servic
e","kind":"services","uid":"8fa61327-0158-4d1c-a48a-2364150545d8"}}
$ kubectl create --raw /api/v1/namespaces/demo-1/services -f service.json | jq
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "nginx-service",
"namespace": "demo-1",
"uid": "5f3677d9-0f59-4197-91ec-f4f989f9a8a6",
"resourceVersion": "14096",
"creationTimestamp": "2021-12-12T18:37:58Z",
"labels": {
...
© 2021 Kasten, Inc.
Raw Option
$ kubectl get --raw /api/v1/services?limit=2 | jq
{
"kind": "ServiceList",
"apiVersion": "v1",
"metadata": {
"resourceVersion": "63838",
"continue":
"eyJ2IjoibWV0YS5rOHMuaW8vdjEiLCJydiI6NjM4MzgsInN0YXJ0IjoiZGVmYXVsdC9wb3N0Z3Jlc3FsXHUwMDAwIn0",
"remainingItemCount": 3
},
"items": [
{
...
© 2021 Kasten, Inc.
Raw Option
● Access to GET, POST and DELETE method for API service calls
● Can add URL query arguments
© 2021 Kasten, Inc.
Port Forwarding
● Forwards TCP ports to Pods and Services
● Uses HTTP/2 streams
● Useful for using local web-browser to view cluster services
● Will pass-through TCP protocols other than HTTP and HTTPS
© 2021 Kasten, Inc.
Port Forwarding
$ kubectl port-forward -n demo-1 pod/nginx-deployment-66b6c48dd5-wst5h :80
Forwarding from 127.0.0.1:54688 -> 80
Forwarding from [::1]:54688 -> 80
$ curl http://localhost:54688/
Handling connection for 54688
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
© 2021 Kasten, Inc.
Logs
● Forwards stdout and stderr from Pods to logging subsystem
● Logs can be retrieved for the previous container instance
● stderr and stdout merged
● Logs are rotated automatically
● kubectl logs only accesses last log rotation
© 2021 Kasten, Inc.
Logs
$ kubectl logs -n demo-1 deployment/nginx-deployment --all-containers
127.0.0.1 - - [30/Aug/2021:20:07:00 +0000] "GET / HTTP/1.1" 200 612 "-" "Mozilla/5.0
(Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.1
Safari/605.1.15" "-"
...
$ kubectl logs --prefix -n demo-1 -lapp=nginx --all-containers
[pod/nginx-deployment-66b6c48dd5-wst5h/nginx] 127.0.0.1 - - [30/Aug/2021:20:07:00 +0000]
"GET / HTTP/1.1" 200 612 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)
AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.1 Safari/605.1.15" "-"
...
© 2021 Kasten, Inc.
Attach
● Forwards stdin, stdout and stderr
● Can allocate tty - effects signal handling
● Distinguish between stdout and stderr
● Attaches stdout, stderr and stdin of PID 1
© 2021 Kasten, Inc.
Attach
$ kubectl attach -n demo-1 nginx-deployment-66b6c48dd5-wst5h
If you don't see a command prompt, try pressing enter
© 2021 Kasten, Inc.
Attach
$ kubectl run -it --rm busybox --image=busybox
If you don't see a command prompt, try pressing enter.
/ # tty
/dev/pts/0
/ # ls -l /proc/1/fd
total 0
lrwx------ 1 root root 64 Dec 13 21:26 0 -> /dev/pts/0
lrwx------ 1 root root 64 Dec 13 21:26 1 -> /dev/pts/0
lrwx------ 1 root root 64 Dec 13 21:26 10 -> /dev/tty
lrwx------ 1 root root 64 Dec 13 21:26 2 -> /dev/pts/0
/ #
Session ended, resume using 'kubectl attach busybox -c busybox -i -t' command when the pod
is running
pod "busybox" deleted
© 2021 Kasten, Inc.
Attach
$ kubectl run -i --rm busybox --image=busybox
If you don't see a command prompt, try pressing enter.
tty
not a tty
ls -l /proc/1/fd
total 0
lr-x------ 1 root root 64 Dec 13 21:27 0 -> pipe:[1343480]
l-wx------ 1 root root 64 Dec 13 21:27 1 -> pipe:[1343481]
l-wx------ 1 root root 64 Dec 13 21:27 2 -> pipe:[1343482]
pod "busybox" deleted
© 2021 Kasten, Inc.
Attach
$ kubectl run -it busybox --image=busybox --attach=false
pod/busybox created
$ kubectl attach -it busybox
If you don't see a command prompt, try pressing enter.
/ # pwd
/
/ #
© 2021 Kasten, Inc.
Attach
$ kubectl run -it busybox --image=busybox --attach=false
pod/busybox created
$ kubectl attach -i busybox 1>stdout.out 2>stderr.out
echo "stdout" >&1
echo "stderr" >&2
^D
$ cat stdout.out
/ # echo "stdout" >&1
stdout
/ # echo "stderr" >&2
stderr
/ #
$ cat stderr.out
If you don't see a command prompt, try pressing enter.
© 2021 Kasten, Inc.
Attach
$ kubectl run -i busybox --image=busybox --attach=false
pod/busybox created
$ kubectl attach -i busybox 1>stdout.out 2>stderr.out
echo "stdout" >&1
echo "stderr" >&2
^D
$ cat stdout.out
stdout
$ cat stderr.out
If you don't see a command prompt, try pressing enter.
stderr
© 2021 Kasten, Inc.
● kubectl attach routes stdout, stderr and stdin to client
● stdout and stderr will be "flattened" if a tty is allocated
Attach
© 2021 Kasten, Inc.
Proxies, Pods and Ports
● kubectl proxy forwards HTTP traffic to API server
● kubectl -v9 can be used to get curl commands for use with kubectl
proxy
● kubectl with --raw option will meet most needs where HTTP GET,
DELETE or POST is needed
● kubectl attach copies stdout, stderr and stdin to client
● kubectl attach -t folds stderr into stdout
● Port-forwarding forwards TCP traffic for a port via HTTP/2 to a pod or service
© 2021 Kasten, Inc.
References
https://kubernetes.io/docs/concepts/cluster-administration/proxies/
https://kubernetes.io/docs/tasks/administer-cluster/access-cluster-services/
© 2021 Kasten, Inc.
THANK YOU
Aaron Alpar
Member of Technical Staff
Kasten by Veeam

More Related Content

What's hot

A to Z of Docker
A to Z of DockerA to Z of Docker
A to Z of Docker
Swapnil Jain
 
Learning Docker from Square One
Learning Docker from Square OneLearning Docker from Square One
Learning Docker from Square One
Docker, Inc.
 
Kubernetes Application Deployment with Helm - A beginner Guide!
Kubernetes Application Deployment with Helm - A beginner Guide!Kubernetes Application Deployment with Helm - A beginner Guide!
Kubernetes Application Deployment with Helm - A beginner Guide!
Krishna-Kumar
 
Git branching strategies
Git branching strategiesGit branching strategies
Git branching strategies
jstack
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
Aditya Konarde
 
Google Cloud Platform Solutions for DevOps Engineers
Google Cloud Platform Solutions  for DevOps EngineersGoogle Cloud Platform Solutions  for DevOps Engineers
Google Cloud Platform Solutions for DevOps Engineers
Márton Kodok
 
DevOps with Kubernetes
DevOps with KubernetesDevOps with Kubernetes
DevOps with Kubernetes
EastBanc Tachnologies
 
Docker introduction &amp; benefits
Docker introduction &amp; benefitsDocker introduction &amp; benefits
Docker introduction &amp; benefits
Amit Manwade
 
Kubernetes in Docker
Kubernetes in DockerKubernetes in Docker
Kubernetes in Docker
Docker, Inc.
 
What Is Docker? | What Is Docker And How It Works? | Docker Tutorial For Begi...
What Is Docker? | What Is Docker And How It Works? | Docker Tutorial For Begi...What Is Docker? | What Is Docker And How It Works? | Docker Tutorial For Begi...
What Is Docker? | What Is Docker And How It Works? | Docker Tutorial For Begi...
Simplilearn
 
9 steps to awesome with kubernetes
9 steps to awesome with kubernetes9 steps to awesome with kubernetes
9 steps to awesome with kubernetes
BaraniBuuny
 
DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...
DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...
DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...
Simplilearn
 
Git Tutorial
Git TutorialGit Tutorial
Git Tutorial
MDLicht
 
Dev ops != Dev+Ops
Dev ops != Dev+OpsDev ops != Dev+Ops
Dev ops != Dev+Ops
Shalu Ahuja
 
Docker Ecosystem on Azure
Docker Ecosystem on AzureDocker Ecosystem on Azure
Docker Ecosystem on Azure
Patrick Chanezon
 
GitLab.pptx
GitLab.pptxGitLab.pptx
GitLab.pptx
LeoulZewelde1
 
PowerShell: Automation for Everyone
PowerShell: Automation for EveryonePowerShell: Automation for Everyone
PowerShell: Automation for Everyone
Intergen
 
Containers and CloudStack
Containers and CloudStackContainers and CloudStack
Containers and CloudStack
ShapeBlue
 
Introduction to Kubernetes with demo
Introduction to Kubernetes with demoIntroduction to Kubernetes with demo
Introduction to Kubernetes with demo
Opsta
 
Git Tutorial | Git Basics - Branching, Merging, Rebasing | Learn Git | DevOps...
Git Tutorial | Git Basics - Branching, Merging, Rebasing | Learn Git | DevOps...Git Tutorial | Git Basics - Branching, Merging, Rebasing | Learn Git | DevOps...
Git Tutorial | Git Basics - Branching, Merging, Rebasing | Learn Git | DevOps...
Edureka!
 

What's hot (20)

A to Z of Docker
A to Z of DockerA to Z of Docker
A to Z of Docker
 
Learning Docker from Square One
Learning Docker from Square OneLearning Docker from Square One
Learning Docker from Square One
 
Kubernetes Application Deployment with Helm - A beginner Guide!
Kubernetes Application Deployment with Helm - A beginner Guide!Kubernetes Application Deployment with Helm - A beginner Guide!
Kubernetes Application Deployment with Helm - A beginner Guide!
 
Git branching strategies
Git branching strategiesGit branching strategies
Git branching strategies
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
Google Cloud Platform Solutions for DevOps Engineers
Google Cloud Platform Solutions  for DevOps EngineersGoogle Cloud Platform Solutions  for DevOps Engineers
Google Cloud Platform Solutions for DevOps Engineers
 
DevOps with Kubernetes
DevOps with KubernetesDevOps with Kubernetes
DevOps with Kubernetes
 
Docker introduction &amp; benefits
Docker introduction &amp; benefitsDocker introduction &amp; benefits
Docker introduction &amp; benefits
 
Kubernetes in Docker
Kubernetes in DockerKubernetes in Docker
Kubernetes in Docker
 
What Is Docker? | What Is Docker And How It Works? | Docker Tutorial For Begi...
What Is Docker? | What Is Docker And How It Works? | Docker Tutorial For Begi...What Is Docker? | What Is Docker And How It Works? | Docker Tutorial For Begi...
What Is Docker? | What Is Docker And How It Works? | Docker Tutorial For Begi...
 
9 steps to awesome with kubernetes
9 steps to awesome with kubernetes9 steps to awesome with kubernetes
9 steps to awesome with kubernetes
 
DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...
DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...
DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...
 
Git Tutorial
Git TutorialGit Tutorial
Git Tutorial
 
Dev ops != Dev+Ops
Dev ops != Dev+OpsDev ops != Dev+Ops
Dev ops != Dev+Ops
 
Docker Ecosystem on Azure
Docker Ecosystem on AzureDocker Ecosystem on Azure
Docker Ecosystem on Azure
 
GitLab.pptx
GitLab.pptxGitLab.pptx
GitLab.pptx
 
PowerShell: Automation for Everyone
PowerShell: Automation for EveryonePowerShell: Automation for Everyone
PowerShell: Automation for Everyone
 
Containers and CloudStack
Containers and CloudStackContainers and CloudStack
Containers and CloudStack
 
Introduction to Kubernetes with demo
Introduction to Kubernetes with demoIntroduction to Kubernetes with demo
Introduction to Kubernetes with demo
 
Git Tutorial | Git Basics - Branching, Merging, Rebasing | Learn Git | DevOps...
Git Tutorial | Git Basics - Branching, Merging, Rebasing | Learn Git | DevOps...Git Tutorial | Git Basics - Branching, Merging, Rebasing | Learn Git | DevOps...
Git Tutorial | Git Basics - Branching, Merging, Rebasing | Learn Git | DevOps...
 

Similar to Ports, pods and proxies

Istio Playground
Istio PlaygroundIstio Playground
Istio Playground
QAware GmbH
 
Kubernetes extensibility
Kubernetes extensibilityKubernetes extensibility
Kubernetes extensibility
Docker, Inc.
 
Scaling docker with kubernetes
Scaling docker with kubernetesScaling docker with kubernetes
Scaling docker with kubernetes
Liran Cohen
 
Introduction to Kubernetes
Introduction to KubernetesIntroduction to Kubernetes
Introduction to Kubernetes
Paul Czarkowski
 
OSS Japan 2019 service mesh bridging Kubernetes and legacy
OSS Japan 2019 service mesh bridging Kubernetes and legacyOSS Japan 2019 service mesh bridging Kubernetes and legacy
OSS Japan 2019 service mesh bridging Kubernetes and legacy
Steve Wong
 
Dayta AI Seminar - Kubernetes, Docker and AI on Cloud
Dayta AI Seminar - Kubernetes, Docker and AI on CloudDayta AI Seminar - Kubernetes, Docker and AI on Cloud
Dayta AI Seminar - Kubernetes, Docker and AI on Cloud
Jung-Hong Kim
 
client-go: The Good, The Bad and The Ugly
client-go: The Good, The Bad and The Uglyclient-go: The Good, The Bad and The Ugly
client-go: The Good, The Bad and The Ugly
Lili Cosic
 
Docker Enterprise Workshop - Technical
Docker Enterprise Workshop - TechnicalDocker Enterprise Workshop - Technical
Docker Enterprise Workshop - Technical
Patrick Chanezon
 
The Challenges of Becoming Cloud Native
The Challenges of Becoming Cloud NativeThe Challenges of Becoming Cloud Native
The Challenges of Becoming Cloud Native
Ben Hall
 
Kubernetes Architecture and Introduction
Kubernetes Architecture and IntroductionKubernetes Architecture and Introduction
Kubernetes Architecture and Introduction
Stefan Schimanski
 
Docker Networking - Common Issues and Troubleshooting Techniques
Docker Networking - Common Issues and Troubleshooting TechniquesDocker Networking - Common Issues and Troubleshooting Techniques
Docker Networking - Common Issues and Troubleshooting Techniques
Sreenivas Makam
 
Kubernetes Basis: Pods, Deployments, and Services
Kubernetes Basis: Pods, Deployments, and ServicesKubernetes Basis: Pods, Deployments, and Services
Kubernetes Basis: Pods, Deployments, and Services
Jian-Kai Wang
 
Cloud-native applications with Java and Kubernetes - Yehor Volkov
 Cloud-native applications with Java and Kubernetes - Yehor Volkov Cloud-native applications with Java and Kubernetes - Yehor Volkov
Cloud-native applications with Java and Kubernetes - Yehor Volkov
Kuberton
 
Kubered -Recipes for C2 Operations on Kubernetes
Kubered -Recipes for C2 Operations on KubernetesKubered -Recipes for C2 Operations on Kubernetes
Kubered -Recipes for C2 Operations on Kubernetes
Jeffrey Holden
 
Deploying windows containers with kubernetes
Deploying windows containers with kubernetesDeploying windows containers with kubernetes
Deploying windows containers with kubernetes
Ben Hall
 
Kubernetes for java developers - Tutorial at Oracle Code One 2018
Kubernetes for java developers - Tutorial at Oracle Code One 2018Kubernetes for java developers - Tutorial at Oracle Code One 2018
Kubernetes for java developers - Tutorial at Oracle Code One 2018
Anthony Dahanne
 
OSMC 2022 | Ignite: Observability with Grafana & Prometheus for Kafka on Kube...
OSMC 2022 | Ignite: Observability with Grafana & Prometheus for Kafka on Kube...OSMC 2022 | Ignite: Observability with Grafana & Prometheus for Kafka on Kube...
OSMC 2022 | Ignite: Observability with Grafana & Prometheus for Kafka on Kube...
NETWAYS
 
KubeCon EU 2016: Creating an Advanced Load Balancing Solution for Kubernetes ...
KubeCon EU 2016: Creating an Advanced Load Balancing Solution for Kubernetes ...KubeCon EU 2016: Creating an Advanced Load Balancing Solution for Kubernetes ...
KubeCon EU 2016: Creating an Advanced Load Balancing Solution for Kubernetes ...
KubeAcademy
 
Kubernetes
KubernetesKubernetes
Kubernetes
Meng-Ze Lee
 
Kubernetes for the PHP developer
Kubernetes for the PHP developerKubernetes for the PHP developer
Kubernetes for the PHP developer
Paul Czarkowski
 

Similar to Ports, pods and proxies (20)

Istio Playground
Istio PlaygroundIstio Playground
Istio Playground
 
Kubernetes extensibility
Kubernetes extensibilityKubernetes extensibility
Kubernetes extensibility
 
Scaling docker with kubernetes
Scaling docker with kubernetesScaling docker with kubernetes
Scaling docker with kubernetes
 
Introduction to Kubernetes
Introduction to KubernetesIntroduction to Kubernetes
Introduction to Kubernetes
 
OSS Japan 2019 service mesh bridging Kubernetes and legacy
OSS Japan 2019 service mesh bridging Kubernetes and legacyOSS Japan 2019 service mesh bridging Kubernetes and legacy
OSS Japan 2019 service mesh bridging Kubernetes and legacy
 
Dayta AI Seminar - Kubernetes, Docker and AI on Cloud
Dayta AI Seminar - Kubernetes, Docker and AI on CloudDayta AI Seminar - Kubernetes, Docker and AI on Cloud
Dayta AI Seminar - Kubernetes, Docker and AI on Cloud
 
client-go: The Good, The Bad and The Ugly
client-go: The Good, The Bad and The Uglyclient-go: The Good, The Bad and The Ugly
client-go: The Good, The Bad and The Ugly
 
Docker Enterprise Workshop - Technical
Docker Enterprise Workshop - TechnicalDocker Enterprise Workshop - Technical
Docker Enterprise Workshop - Technical
 
The Challenges of Becoming Cloud Native
The Challenges of Becoming Cloud NativeThe Challenges of Becoming Cloud Native
The Challenges of Becoming Cloud Native
 
Kubernetes Architecture and Introduction
Kubernetes Architecture and IntroductionKubernetes Architecture and Introduction
Kubernetes Architecture and Introduction
 
Docker Networking - Common Issues and Troubleshooting Techniques
Docker Networking - Common Issues and Troubleshooting TechniquesDocker Networking - Common Issues and Troubleshooting Techniques
Docker Networking - Common Issues and Troubleshooting Techniques
 
Kubernetes Basis: Pods, Deployments, and Services
Kubernetes Basis: Pods, Deployments, and ServicesKubernetes Basis: Pods, Deployments, and Services
Kubernetes Basis: Pods, Deployments, and Services
 
Cloud-native applications with Java and Kubernetes - Yehor Volkov
 Cloud-native applications with Java and Kubernetes - Yehor Volkov Cloud-native applications with Java and Kubernetes - Yehor Volkov
Cloud-native applications with Java and Kubernetes - Yehor Volkov
 
Kubered -Recipes for C2 Operations on Kubernetes
Kubered -Recipes for C2 Operations on KubernetesKubered -Recipes for C2 Operations on Kubernetes
Kubered -Recipes for C2 Operations on Kubernetes
 
Deploying windows containers with kubernetes
Deploying windows containers with kubernetesDeploying windows containers with kubernetes
Deploying windows containers with kubernetes
 
Kubernetes for java developers - Tutorial at Oracle Code One 2018
Kubernetes for java developers - Tutorial at Oracle Code One 2018Kubernetes for java developers - Tutorial at Oracle Code One 2018
Kubernetes for java developers - Tutorial at Oracle Code One 2018
 
OSMC 2022 | Ignite: Observability with Grafana & Prometheus for Kafka on Kube...
OSMC 2022 | Ignite: Observability with Grafana & Prometheus for Kafka on Kube...OSMC 2022 | Ignite: Observability with Grafana & Prometheus for Kafka on Kube...
OSMC 2022 | Ignite: Observability with Grafana & Prometheus for Kafka on Kube...
 
KubeCon EU 2016: Creating an Advanced Load Balancing Solution for Kubernetes ...
KubeCon EU 2016: Creating an Advanced Load Balancing Solution for Kubernetes ...KubeCon EU 2016: Creating an Advanced Load Balancing Solution for Kubernetes ...
KubeCon EU 2016: Creating an Advanced Load Balancing Solution for Kubernetes ...
 
Kubernetes
KubernetesKubernetes
Kubernetes
 
Kubernetes for the PHP developer
Kubernetes for the PHP developerKubernetes for the PHP developer
Kubernetes for the PHP developer
 

More from LibbySchulze

Running distributed tests with k6.pdf
Running distributed tests with k6.pdfRunning distributed tests with k6.pdf
Running distributed tests with k6.pdf
LibbySchulze
 
Extending Kubectl.pptx
Extending Kubectl.pptxExtending Kubectl.pptx
Extending Kubectl.pptx
LibbySchulze
 
Enhancing Data Protection Workflows with Kanister And Argo Workflows
Enhancing Data Protection Workflows with Kanister And Argo WorkflowsEnhancing Data Protection Workflows with Kanister And Argo Workflows
Enhancing Data Protection Workflows with Kanister And Argo Workflows
LibbySchulze
 
Fallacies in Platform Engineering.pdf
Fallacies in Platform Engineering.pdfFallacies in Platform Engineering.pdf
Fallacies in Platform Engineering.pdf
LibbySchulze
 
Intro to Fluvio.pptx.pdf
Intro to Fluvio.pptx.pdfIntro to Fluvio.pptx.pdf
Intro to Fluvio.pptx.pdf
LibbySchulze
 
Enhance your Kafka Infrastructure with Fluvio.pptx
Enhance your Kafka Infrastructure with Fluvio.pptxEnhance your Kafka Infrastructure with Fluvio.pptx
Enhance your Kafka Infrastructure with Fluvio.pptx
LibbySchulze
 
CNCF On-Demand Webinar_ LitmusChaos Project Updates.pdf
CNCF On-Demand Webinar_ LitmusChaos Project Updates.pdfCNCF On-Demand Webinar_ LitmusChaos Project Updates.pdf
CNCF On-Demand Webinar_ LitmusChaos Project Updates.pdf
LibbySchulze
 
Oh The Places You'll Sign.pdf
Oh The Places You'll Sign.pdfOh The Places You'll Sign.pdf
Oh The Places You'll Sign.pdf
LibbySchulze
 
Rancher MasterClass - Avoiding-configuration-drift.pptx
Rancher  MasterClass - Avoiding-configuration-drift.pptxRancher  MasterClass - Avoiding-configuration-drift.pptx
Rancher MasterClass - Avoiding-configuration-drift.pptx
LibbySchulze
 
vFunction Konveyor Meetup - Why App Modernization Projects Fail - Aug 2022.pptx
vFunction Konveyor Meetup - Why App Modernization Projects Fail - Aug 2022.pptxvFunction Konveyor Meetup - Why App Modernization Projects Fail - Aug 2022.pptx
vFunction Konveyor Meetup - Why App Modernization Projects Fail - Aug 2022.pptx
LibbySchulze
 
CNCF Live Webinar: Low Footprint Java Containers with GraalVM
CNCF Live Webinar: Low Footprint Java Containers with GraalVMCNCF Live Webinar: Low Footprint Java Containers with GraalVM
CNCF Live Webinar: Low Footprint Java Containers with GraalVM
LibbySchulze
 
EnRoute-OPA-Integration.pdf
EnRoute-OPA-Integration.pdfEnRoute-OPA-Integration.pdf
EnRoute-OPA-Integration.pdf
LibbySchulze
 
AirGap_zusammen_neu.pdf
AirGap_zusammen_neu.pdfAirGap_zusammen_neu.pdf
AirGap_zusammen_neu.pdf
LibbySchulze
 
Copy of OTel Me All About OpenTelemetry The Current & Future State, Navigatin...
Copy of OTel Me All About OpenTelemetry The Current & Future State, Navigatin...Copy of OTel Me All About OpenTelemetry The Current & Future State, Navigatin...
Copy of OTel Me All About OpenTelemetry The Current & Future State, Navigatin...
LibbySchulze
 
OTel Me All About OpenTelemetry The Current & Future State, Navigating the Pr...
OTel Me All About OpenTelemetry The Current & Future State, Navigating the Pr...OTel Me All About OpenTelemetry The Current & Future State, Navigating the Pr...
OTel Me All About OpenTelemetry The Current & Future State, Navigating the Pr...
LibbySchulze
 
CNCF_ A step to step guide to platforming your delivery setup.pdf
CNCF_ A step to step guide to platforming your delivery setup.pdfCNCF_ A step to step guide to platforming your delivery setup.pdf
CNCF_ A step to step guide to platforming your delivery setup.pdf
LibbySchulze
 
CNCF Online - Data Protection Guardrails using Open Policy Agent (OPA).pdf
CNCF Online - Data Protection Guardrails using Open Policy Agent (OPA).pdfCNCF Online - Data Protection Guardrails using Open Policy Agent (OPA).pdf
CNCF Online - Data Protection Guardrails using Open Policy Agent (OPA).pdf
LibbySchulze
 
Securing Windows workloads.pdf
Securing Windows workloads.pdfSecuring Windows workloads.pdf
Securing Windows workloads.pdf
LibbySchulze
 
Securing Windows workloads.pdf
Securing Windows workloads.pdfSecuring Windows workloads.pdf
Securing Windows workloads.pdf
LibbySchulze
 
Advancements in Kubernetes Workload Identity for Azure
Advancements in Kubernetes Workload Identity for AzureAdvancements in Kubernetes Workload Identity for Azure
Advancements in Kubernetes Workload Identity for Azure
LibbySchulze
 

More from LibbySchulze (20)

Running distributed tests with k6.pdf
Running distributed tests with k6.pdfRunning distributed tests with k6.pdf
Running distributed tests with k6.pdf
 
Extending Kubectl.pptx
Extending Kubectl.pptxExtending Kubectl.pptx
Extending Kubectl.pptx
 
Enhancing Data Protection Workflows with Kanister And Argo Workflows
Enhancing Data Protection Workflows with Kanister And Argo WorkflowsEnhancing Data Protection Workflows with Kanister And Argo Workflows
Enhancing Data Protection Workflows with Kanister And Argo Workflows
 
Fallacies in Platform Engineering.pdf
Fallacies in Platform Engineering.pdfFallacies in Platform Engineering.pdf
Fallacies in Platform Engineering.pdf
 
Intro to Fluvio.pptx.pdf
Intro to Fluvio.pptx.pdfIntro to Fluvio.pptx.pdf
Intro to Fluvio.pptx.pdf
 
Enhance your Kafka Infrastructure with Fluvio.pptx
Enhance your Kafka Infrastructure with Fluvio.pptxEnhance your Kafka Infrastructure with Fluvio.pptx
Enhance your Kafka Infrastructure with Fluvio.pptx
 
CNCF On-Demand Webinar_ LitmusChaos Project Updates.pdf
CNCF On-Demand Webinar_ LitmusChaos Project Updates.pdfCNCF On-Demand Webinar_ LitmusChaos Project Updates.pdf
CNCF On-Demand Webinar_ LitmusChaos Project Updates.pdf
 
Oh The Places You'll Sign.pdf
Oh The Places You'll Sign.pdfOh The Places You'll Sign.pdf
Oh The Places You'll Sign.pdf
 
Rancher MasterClass - Avoiding-configuration-drift.pptx
Rancher  MasterClass - Avoiding-configuration-drift.pptxRancher  MasterClass - Avoiding-configuration-drift.pptx
Rancher MasterClass - Avoiding-configuration-drift.pptx
 
vFunction Konveyor Meetup - Why App Modernization Projects Fail - Aug 2022.pptx
vFunction Konveyor Meetup - Why App Modernization Projects Fail - Aug 2022.pptxvFunction Konveyor Meetup - Why App Modernization Projects Fail - Aug 2022.pptx
vFunction Konveyor Meetup - Why App Modernization Projects Fail - Aug 2022.pptx
 
CNCF Live Webinar: Low Footprint Java Containers with GraalVM
CNCF Live Webinar: Low Footprint Java Containers with GraalVMCNCF Live Webinar: Low Footprint Java Containers with GraalVM
CNCF Live Webinar: Low Footprint Java Containers with GraalVM
 
EnRoute-OPA-Integration.pdf
EnRoute-OPA-Integration.pdfEnRoute-OPA-Integration.pdf
EnRoute-OPA-Integration.pdf
 
AirGap_zusammen_neu.pdf
AirGap_zusammen_neu.pdfAirGap_zusammen_neu.pdf
AirGap_zusammen_neu.pdf
 
Copy of OTel Me All About OpenTelemetry The Current & Future State, Navigatin...
Copy of OTel Me All About OpenTelemetry The Current & Future State, Navigatin...Copy of OTel Me All About OpenTelemetry The Current & Future State, Navigatin...
Copy of OTel Me All About OpenTelemetry The Current & Future State, Navigatin...
 
OTel Me All About OpenTelemetry The Current & Future State, Navigating the Pr...
OTel Me All About OpenTelemetry The Current & Future State, Navigating the Pr...OTel Me All About OpenTelemetry The Current & Future State, Navigating the Pr...
OTel Me All About OpenTelemetry The Current & Future State, Navigating the Pr...
 
CNCF_ A step to step guide to platforming your delivery setup.pdf
CNCF_ A step to step guide to platforming your delivery setup.pdfCNCF_ A step to step guide to platforming your delivery setup.pdf
CNCF_ A step to step guide to platforming your delivery setup.pdf
 
CNCF Online - Data Protection Guardrails using Open Policy Agent (OPA).pdf
CNCF Online - Data Protection Guardrails using Open Policy Agent (OPA).pdfCNCF Online - Data Protection Guardrails using Open Policy Agent (OPA).pdf
CNCF Online - Data Protection Guardrails using Open Policy Agent (OPA).pdf
 
Securing Windows workloads.pdf
Securing Windows workloads.pdfSecuring Windows workloads.pdf
Securing Windows workloads.pdf
 
Securing Windows workloads.pdf
Securing Windows workloads.pdfSecuring Windows workloads.pdf
Securing Windows workloads.pdf
 
Advancements in Kubernetes Workload Identity for Azure
Advancements in Kubernetes Workload Identity for AzureAdvancements in Kubernetes Workload Identity for Azure
Advancements in Kubernetes Workload Identity for Azure
 

Recently uploaded

How to make a complaint to the police for Social Media Fraud.pdf
How to make a complaint to the police for Social Media Fraud.pdfHow to make a complaint to the police for Social Media Fraud.pdf
How to make a complaint to the police for Social Media Fraud.pdf
Infosec train
 
一比一原版(uc毕业证书)加拿大卡尔加里大学毕业证如何办理
一比一原版(uc毕业证书)加拿大卡尔加里大学毕业证如何办理一比一原版(uc毕业证书)加拿大卡尔加里大学毕业证如何办理
一比一原版(uc毕业证书)加拿大卡尔加里大学毕业证如何办理
dtagbe
 
HijackLoader Evolution: Interactive Process Hollowing
HijackLoader Evolution: Interactive Process HollowingHijackLoader Evolution: Interactive Process Hollowing
HijackLoader Evolution: Interactive Process Hollowing
Donato Onofri
 
一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理
一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理
一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理
thezot
 
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
rtunex8r
 
Bengaluru Dreamin' 24 - Personal Branding
Bengaluru Dreamin' 24 - Personal BrandingBengaluru Dreamin' 24 - Personal Branding
Bengaluru Dreamin' 24 - Personal Branding
Tarandeep Singh
 
cyber crime.pptx..........................
cyber crime.pptx..........................cyber crime.pptx..........................
cyber crime.pptx..........................
GNAMBIKARAO
 
Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...
Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...
Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...
APNIC
 
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
3a0sd7z3
 
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
3a0sd7z3
 
Securing BGP: Operational Strategies and Best Practices for Network Defenders...
Securing BGP: Operational Strategies and Best Practices for Network Defenders...Securing BGP: Operational Strategies and Best Practices for Network Defenders...
Securing BGP: Operational Strategies and Best Practices for Network Defenders...
APNIC
 

Recently uploaded (11)

How to make a complaint to the police for Social Media Fraud.pdf
How to make a complaint to the police for Social Media Fraud.pdfHow to make a complaint to the police for Social Media Fraud.pdf
How to make a complaint to the police for Social Media Fraud.pdf
 
一比一原版(uc毕业证书)加拿大卡尔加里大学毕业证如何办理
一比一原版(uc毕业证书)加拿大卡尔加里大学毕业证如何办理一比一原版(uc毕业证书)加拿大卡尔加里大学毕业证如何办理
一比一原版(uc毕业证书)加拿大卡尔加里大学毕业证如何办理
 
HijackLoader Evolution: Interactive Process Hollowing
HijackLoader Evolution: Interactive Process HollowingHijackLoader Evolution: Interactive Process Hollowing
HijackLoader Evolution: Interactive Process Hollowing
 
一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理
一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理
一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理
 
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
 
Bengaluru Dreamin' 24 - Personal Branding
Bengaluru Dreamin' 24 - Personal BrandingBengaluru Dreamin' 24 - Personal Branding
Bengaluru Dreamin' 24 - Personal Branding
 
cyber crime.pptx..........................
cyber crime.pptx..........................cyber crime.pptx..........................
cyber crime.pptx..........................
 
Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...
Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...
Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...
 
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
 
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
 
Securing BGP: Operational Strategies and Best Practices for Network Defenders...
Securing BGP: Operational Strategies and Best Practices for Network Defenders...Securing BGP: Operational Strategies and Best Practices for Network Defenders...
Securing BGP: Operational Strategies and Best Practices for Network Defenders...
 

Ports, pods and proxies

  • 1. © 2021 Kasten, Inc. Proxies, Pods and Ports Aaron Alpar Member of Technical Staff Kasten by Veeam
  • 2. © 2021 Kasten, Inc. 1. Introduction 2. Setup - the .yaml files 3. Kubernetes API Proxies 4. Using kubectl's --raw opton 5. Port forwarding with kubectl port-forward-ing 6. kubectl logs and kubectl attach Agenda
  • 3. © 2021 Kasten, Inc. Proxies, Pods and Ports Pods have various access points exposed via kubectl ● As proxy through the API server ● Through port-forwarding ● Through stdin, stdout and stderr
  • 4. © 2021 Kasten, Inc. The Deployment $ cat deployment.yaml apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment namespace: demo-1 spec: selector: matchLabels: app: nginx replicas: 1 template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:1.14.2 ports: - containerPort: 80
  • 5. © 2021 Kasten, Inc. The Service $ cat service.yaml apiVersion: v1 kind: Service metadata: name: nginx-service namespace: demo-1 labels: run: nginx spec: selector: app: nginx ports: - name: http protocol: TCP port: 80
  • 6. © 2021 Kasten, Inc. API Server Proxy ● Direct access to API server ● Forwards HTTP connections from local port to API server ● Forwarded connections will be amended with authentication state ● Similar to using --raw
  • 7. © 2021 Kasten, Inc. API Server Proxy $ kubectl proxy Starting to serve on 127.0.0.1:8001 $ curl http://localhost:8001/ { "paths": [ "/.well-known/openid-configuration", "/api", "/api/v1", "/apis", "/apis/", "/apis/admissionregistration.k8s.io", "/apis/admissionregistration.k8s.io/v1", ...
  • 8. © 2021 Kasten, Inc. API Server Proxy $ kubectl get namespaces NAME STATUS AGE default Active 22h demo-1 Active 3m46s kube-node-lease Active 22h $ curl http://localhost:8001/api/v1/namespaces { "kind": "NamespaceList", "apiVersion": "v1", "metadata": { "resourceVersion": "2812175" }, "items": [ { "metadata": { "name": "default", ...
  • 9. © 2021 Kasten, Inc. API Server Proxy $ kubectl get pods -n demo-1 nginx-deployment-66b6c48dd5-wst5h NAME READY STATUS RESTARTS AGE nginx-deployment-66b6c48dd5-wst5h 1/1 Running 0 32m $ curl http://localhost:8001/api/v1/namespaces/demo-1/pods/nginx-deployment-66b6c48dd5-wst5h { "kind": "Pod", "apiVersion": "v1", "metadata": { "name": "nginx-deployment-66b6c48dd5-wst5h", ...
  • 10. © 2021 Kasten, Inc. API Server Proxy Access to HTTP and HTTPS services in ● Services ● Pods
  • 11. © 2021 Kasten, Inc. API Server Proxy: Service Ports $ curl http://localhost:8001/api/v1/namespaces/demo-1/services/nginx-service:http/proxy/ <!DOCTYPE html> <html> <head> <title>Welcome to nginx!</title> <style> body { width: 35em; margin: 0 auto; font-family: Tahoma, Verdana, Arial, sans-serif; } ...
  • 12. © 2021 Kasten, Inc. API Server Proxy: Service Ports $ curl http://localhost:8001/api/v1/namespaces/demo-1/services/nginx-service:http/proxy/ <!DOCTYPE html> <html> <head> <title>Welcome to nginx!</title> <style> body { width: 35em; margin: 0 auto; font-family: Tahoma, Verdana, Arial, sans-serif; } ...
  • 13. © 2021 Kasten, Inc. API Server Proxy: Service Ports $ curl http://localhost:8001/api/v1/namespaces/demo-1/services/nginx-service:http/proxy/ ... $ cat service.yaml ... selector: app: nginx ports: - name: http protocol: TCP port: 80 ...
  • 14. © 2021 Kasten, Inc. API Server Proxy: Service Ports Proxy URL form for a Service port /api/v1/namespaces/namespace_name/services/[https:]service_name[:port_name]/proxy
  • 15. © 2021 Kasten, Inc. API Server Proxy: Pod Ports $ curl http://localhost:8001/api/v1/namespaces/demo-1/pods/nginx-deployment-66b6c48dd5-t8446:80/proxy/ <!DOCTYPE html> <html> <head> <title>Welcome to nginx!</title> <style> body { width: 35em; margin: 0 auto; font-family: Tahoma, Verdana, Arial, sans-serif; } ...
  • 16. © 2021 Kasten, Inc. API Server Proxy: Pod Ports $ curl http://localhost:8001/api/v1/namespaces/demo-1/pods/nginx-deployment-66b6c48dd5-t8446:80/p roxy/ <!DOCTYPE html> <html> <head> <title>Welcome to nginx!</title> <style> body { width: 35em; margin: 0 auto; font-family: Tahoma, Verdana, Arial, sans-serif; } ...
  • 17. © 2021 Kasten, Inc. API Server Proxy: Pod Ports $ curl http://localhost:8001/api/v1/namespaces/demo-1/pods/nginx-deployment-66b6c48dd5-t8446:80/proxy/ ... $ kubectl get pod -n demo-1 nginx-deployment-66b6c48dd5-t8446 -o yaml ... containers: - image: nginx:1.14.2 name: nginx ports: - containerPort: 80 protocol: TCP ...
  • 18. © 2021 Kasten, Inc. API Server Proxy: Pod Ports Proxy URL form for a Pod port /api/v1/namespaces/namespace_name/pods/[https:]pod_name[:port_number]/proxy
  • 19. © 2021 Kasten, Inc. API Server Proxy ● kubectl proxy provides access to API server HTTPS endpoint ● Can be used to access service and pod endpoints ● Useful for debugging
  • 20. © 2021 Kasten, Inc. kubectl -v9 $ kubectl -v9 get pods -A I1213 08:00:16.355063 98152 loader.go:372] Config loaded from file: /Users/aalpar/.kube/config I1213 08:00:16.360303 98152 round_trippers.go:435] curl -k -v -XGET -H "Accept: application/json;as=Table;v=v1;g=meta.k8s.io,application/json;as=Table;v=v1beta1;g=meta.k8 s.io,application/json" -H "User-Agent: kubectl/v1.21.5 (darwin/amd64) kubernetes/aea7bba" 'https://127.0.0.1:64926/api/v1/pods?limit=500' I1213 08:00:16.371606 98152 round_trippers.go:454] GET https://127.0.0.1:64926/api/v1/pods?limit=500 200 OK in 11 milliseconds ...
  • 21. © 2021 Kasten, Inc. kubectl -v9 $ kubectl -v9 get pods -A I1213 08:00:16.355063 98152 loader.go:372] Config loaded from file: /Users/aalpar/.kube/config I1213 08:00:16.360303 98152 round_trippers.go:435] curl -k -v -XGET -H "Accept: application/json;as=Table;v=v1;g=meta.k8s.io,application/json;as=Table;v=v1beta1;g=meta.k8 s.io,application/json" -H "User-Agent: kubectl/v1.21.5 (darwin/amd64) kubernetes/aea7bba" 'https://127.0.0.1:64926/api/v1/pods?limit=500' I1213 08:00:16.371606 98152 round_trippers.go:454] GET https://127.0.0.1:64926/api/v1/pods?limit=500 200 OK in 11 milliseconds ...
  • 22. © 2021 Kasten, Inc. kubectl -v9 ● Non truncated kubectl debugging output ● Useful for getting curl versions of kubectl commands ● curl commands can be used in conjunction with kubectl proxy ● Values less than 9 provide less output
  • 23. © 2021 Kasten, Inc. Raw Option ● kubectl --raw used to submit URL to the API server ● Can be used with get, create, delete
  • 24. © 2021 Kasten, Inc. Raw Option $ kubectl get --raw /api/v1/namespaces | jq { "kind": "NamespaceList", "apiVersion": "v1", "metadata": { "resourceVersion": "2812175" }, "items": [ { "metadata": { "name": "default", ...
  • 25. © 2021 Kasten, Inc. Raw Option $ kubectl get --raw /api/v1/namespaces/demo-1/services/nginx-service | jq { "kind": "Service", "apiVersion": "v1", "metadata": { "name": "nginx-service", "namespace": "demo-1", "uid": "8fa61327-0158-4d1c-a48a-2364150545d8", "resourceVersion": "9485", "creationTimestamp": "2021-12-12T17:42:25Z", "labels": { ...
  • 26. © 2021 Kasten, Inc. The Service as JSON $ cat service.json { "apiVersion": "v1", "kind": "Service", "metadata": { "name": "nginx-service", "namespace": "demo-1", "labels": { "run": "nginx" } }, "spec": { "selector": { "app": "nginx" }, "ports": [ { "name": "http", "protocol": "TCP", "port": 80 } ] } }
  • 27. © 2021 Kasten, Inc. Raw Option $ kubectl delete --raw /api/v1/namespaces/demo-1/services/nginx-service {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Success","details":{"name":"nginx-servic e","kind":"services","uid":"8fa61327-0158-4d1c-a48a-2364150545d8"}} $ kubectl create --raw /api/v1/namespaces/demo-1/services -f service.json | jq { "kind": "Service", "apiVersion": "v1", "metadata": { "name": "nginx-service", "namespace": "demo-1", "uid": "5f3677d9-0f59-4197-91ec-f4f989f9a8a6", "resourceVersion": "14096", "creationTimestamp": "2021-12-12T18:37:58Z", "labels": { ...
  • 28. © 2021 Kasten, Inc. Raw Option $ kubectl get --raw /api/v1/services?limit=2 | jq { "kind": "ServiceList", "apiVersion": "v1", "metadata": { "resourceVersion": "63838", "continue": "eyJ2IjoibWV0YS5rOHMuaW8vdjEiLCJydiI6NjM4MzgsInN0YXJ0IjoiZGVmYXVsdC9wb3N0Z3Jlc3FsXHUwMDAwIn0", "remainingItemCount": 3 }, "items": [ { ...
  • 29. © 2021 Kasten, Inc. Raw Option ● Access to GET, POST and DELETE method for API service calls ● Can add URL query arguments
  • 30. © 2021 Kasten, Inc. Port Forwarding ● Forwards TCP ports to Pods and Services ● Uses HTTP/2 streams ● Useful for using local web-browser to view cluster services ● Will pass-through TCP protocols other than HTTP and HTTPS
  • 31. © 2021 Kasten, Inc. Port Forwarding $ kubectl port-forward -n demo-1 pod/nginx-deployment-66b6c48dd5-wst5h :80 Forwarding from 127.0.0.1:54688 -> 80 Forwarding from [::1]:54688 -> 80 $ curl http://localhost:54688/ Handling connection for 54688 <!DOCTYPE html> <html> <head> <title>Welcome to nginx!</title> <style>
  • 32. © 2021 Kasten, Inc. Logs ● Forwards stdout and stderr from Pods to logging subsystem ● Logs can be retrieved for the previous container instance ● stderr and stdout merged ● Logs are rotated automatically ● kubectl logs only accesses last log rotation
  • 33. © 2021 Kasten, Inc. Logs $ kubectl logs -n demo-1 deployment/nginx-deployment --all-containers 127.0.0.1 - - [30/Aug/2021:20:07:00 +0000] "GET / HTTP/1.1" 200 612 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.1 Safari/605.1.15" "-" ... $ kubectl logs --prefix -n demo-1 -lapp=nginx --all-containers [pod/nginx-deployment-66b6c48dd5-wst5h/nginx] 127.0.0.1 - - [30/Aug/2021:20:07:00 +0000] "GET / HTTP/1.1" 200 612 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.1 Safari/605.1.15" "-" ...
  • 34. © 2021 Kasten, Inc. Attach ● Forwards stdin, stdout and stderr ● Can allocate tty - effects signal handling ● Distinguish between stdout and stderr ● Attaches stdout, stderr and stdin of PID 1
  • 35. © 2021 Kasten, Inc. Attach $ kubectl attach -n demo-1 nginx-deployment-66b6c48dd5-wst5h If you don't see a command prompt, try pressing enter
  • 36. © 2021 Kasten, Inc. Attach $ kubectl run -it --rm busybox --image=busybox If you don't see a command prompt, try pressing enter. / # tty /dev/pts/0 / # ls -l /proc/1/fd total 0 lrwx------ 1 root root 64 Dec 13 21:26 0 -> /dev/pts/0 lrwx------ 1 root root 64 Dec 13 21:26 1 -> /dev/pts/0 lrwx------ 1 root root 64 Dec 13 21:26 10 -> /dev/tty lrwx------ 1 root root 64 Dec 13 21:26 2 -> /dev/pts/0 / # Session ended, resume using 'kubectl attach busybox -c busybox -i -t' command when the pod is running pod "busybox" deleted
  • 37. © 2021 Kasten, Inc. Attach $ kubectl run -i --rm busybox --image=busybox If you don't see a command prompt, try pressing enter. tty not a tty ls -l /proc/1/fd total 0 lr-x------ 1 root root 64 Dec 13 21:27 0 -> pipe:[1343480] l-wx------ 1 root root 64 Dec 13 21:27 1 -> pipe:[1343481] l-wx------ 1 root root 64 Dec 13 21:27 2 -> pipe:[1343482] pod "busybox" deleted
  • 38. © 2021 Kasten, Inc. Attach $ kubectl run -it busybox --image=busybox --attach=false pod/busybox created $ kubectl attach -it busybox If you don't see a command prompt, try pressing enter. / # pwd / / #
  • 39. © 2021 Kasten, Inc. Attach $ kubectl run -it busybox --image=busybox --attach=false pod/busybox created $ kubectl attach -i busybox 1>stdout.out 2>stderr.out echo "stdout" >&1 echo "stderr" >&2 ^D $ cat stdout.out / # echo "stdout" >&1 stdout / # echo "stderr" >&2 stderr / # $ cat stderr.out If you don't see a command prompt, try pressing enter.
  • 40. © 2021 Kasten, Inc. Attach $ kubectl run -i busybox --image=busybox --attach=false pod/busybox created $ kubectl attach -i busybox 1>stdout.out 2>stderr.out echo "stdout" >&1 echo "stderr" >&2 ^D $ cat stdout.out stdout $ cat stderr.out If you don't see a command prompt, try pressing enter. stderr
  • 41. © 2021 Kasten, Inc. ● kubectl attach routes stdout, stderr and stdin to client ● stdout and stderr will be "flattened" if a tty is allocated Attach
  • 42. © 2021 Kasten, Inc. Proxies, Pods and Ports ● kubectl proxy forwards HTTP traffic to API server ● kubectl -v9 can be used to get curl commands for use with kubectl proxy ● kubectl with --raw option will meet most needs where HTTP GET, DELETE or POST is needed ● kubectl attach copies stdout, stderr and stdin to client ● kubectl attach -t folds stderr into stdout ● Port-forwarding forwards TCP traffic for a port via HTTP/2 to a pod or service
  • 43. © 2021 Kasten, Inc. References https://kubernetes.io/docs/concepts/cluster-administration/proxies/ https://kubernetes.io/docs/tasks/administer-cluster/access-cluster-services/
  • 44. © 2021 Kasten, Inc. THANK YOU Aaron Alpar Member of Technical Staff Kasten by Veeam