如何使用 python kubernetes 客户端读取 Kubernetes 部署

How to read a Kubernetes Deployment with python kubernetes client

什么是python kubernetes 客户端等同于

kubectl get deploy -o yaml 

CRUD python Client example

我参考了此示例以获取 python 部署 但是没有读取部署选项

read_namespaced_deployment() 做了这件事:

from kubernetes import client, config
config.load_kube_config()
api = client.AppsV1Api()

deployment = api.read_namespaced_deployment(name='foo', namespace='bar')