In this article we will learn about some of the frequently asked GO programming questions in technical like “using heredoc with kubectl create” Code Answer. When creating scripts and web applications, error handling is an important part. If your code lacks error checking code, your program may look very unprofessional and you may be open to security risks. Error or stack handling on go was simple and easy. An error message with filename, line number and a message describing the error is sent to the browser. This tutorial contains some of the most common error checking methods in GO. Below are some solution about “using heredoc with kubectl create” Code Answer.
using heredoc with kubectl create
xxxxxxxxxx
1
# Create multiple YAML objects from stdin
2
cat <<EOF | kubectl apply -f -
3
apiVersion: v1
4
kind: Pod
5
metadata:
6
name: busybox-sleep
7
spec:
8
containers:
9
- name: busybox
10
image: busybox
11
args:
12
- sleep
13
- "1000000"
14
---
15
apiVersion: v1
16
kind: Pod
17
metadata:
18
name: busybox-sleep-less
19
spec:
20
containers:
21
- name: busybox
22
image: busybox
23
args:
24
- sleep
25
- "1000"
26
EOF
27
28
# Create a secret with several keys
29
cat <<EOF | kubectl apply -f -
30
apiVersion: v1
31
kind: Secret
32
metadata:
33
name: mysecret
34
type: Opaque
35
data:
36
password: $(echo -n "s33msi4" | base64 -w0)
37
username: $(echo -n "jane" | base64 -w0)
38
EOF
39
40