Get YAML for Kubernetes Deployed Services?

I am trying to deploy my application to Kubernetes running on the Google Container Engine.

The application can be found at: https://github.com/Industrial/docker-znc .

Dockerfile is embedded in the image in the Google container registry.

I deployed the application to Kubernetes via the + button. I do not have YAML for this.

I inserted Secret in Kubernetes for the PEM file required by the application.

  1. How to get YAML for Kubernetes Deployment, Service and Pod by filling out a form?
  2. How can I get a secret in my pod to use?
+59
source share
7 answers

To get yaml for deployment (service, pod, secret, etc.):

kubectl get deploy deploymentname -o yaml --export
+99
source

for the second privacy issue, this is from the k8s documentation. see https://kubernetes.io/docs/concepts/configuration/secret/#using-secrets for more information.

  • Create a secret or use an existing one. Multiple containers may reference the same secret.
  • Modify your Pod definition to add the volume to spec.volumes []. Name it anything and specify the field spec.volumes []. Secret.secretName, equal to the name of the secret object.
  • spec.containers []. volumeMounts [] , . spec.containers []. VolumeMounts []. ReadOnly = true spec.containers []. VolumeMounts []. MountPath , , .
  • / , . mountPath.

, .

+4

YAML Deployment, Service Pod, Kubernetes, ?

kubectl get deployment,service,pod yourapp -o yaml --export

@Sinaesthetic:

, ( )?

kubectl get deploy --all-namespaces -o yaml --export

, . , , :

kubectl get deploy,sts,svc,configmap,secret -n default -o yaml --export > default.yaml

, kubernetes - get all, , .

kubectl api-resources
+3
  • , "--export" , kubeernetes.
  • "--export" ,
  • "-o yaml" "-o json"
  • , , "--export" (, IP- k8s).
+2

, yaml

kubectl get service servicename -o yaml

-

kubectl get service servicename -o yaml >service.yaml

+1
kubectl -n <namespace> get <resource type> <resource Name> -o yaml 

, Kubernetes, YAML.

0

, :

kubectl edit service servicename

0

Source: https://habr.com/ru/post/1677013/


All Articles