Skip to content

Commit a815a47

Browse files
committed
revise the Kubernetes provider article
1 parent 1187341 commit a815a47

File tree

1 file changed

+117
-5
lines changed

1 file changed

+117
-5
lines changed

articles/azure-resource-manager/bicep/bicep-extensibility-kubernetes-provider.md

Lines changed: 117 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,126 @@ import '[email protected]' with {
3838

3939
The AKS cluster can be a new resource or an existing resource. The [Import Kubernetes manifest command](./visual-studio-code.md#bicep-commands) from Visual Studio Code can automatically add the code snippet automatically.
4040

41-
## How provider-specific resource types are exposed/accessed
41+
## Define Kubernetes deployments and services
42+
43+
*** Do I need to cover how a Kubernetes YML is transformed into Bicep?
44+
45+
```yml
46+
apiVersion: apps/v1
47+
kind: Deployment
48+
metadata:
49+
name: azure-vote-back
50+
spec:
51+
replicas: 1
52+
selector:
53+
matchLabels:
54+
app: azure-vote-back
55+
template:
56+
metadata:
57+
labels:
58+
app: azure-vote-back
59+
spec:
60+
nodeSelector:
61+
"kubernetes.io/os": linux
62+
containers:
63+
- name: azure-vote-back
64+
image: mcr.microsoft.com/oss/bitnami/redis:6.0.8
65+
env:
66+
- name: ALLOW_EMPTY_PASSWORD
67+
value: "yes"
68+
resources:
69+
requests:
70+
cpu: 100m
71+
memory: 128Mi
72+
limits:
73+
cpu: 250m
74+
memory: 256Mi
75+
ports:
76+
- containerPort: 6379
77+
name: redis
78+
---
79+
apiVersion: v1
80+
kind: Service
81+
metadata:
82+
name: azure-vote-back
83+
spec:
84+
ports:
85+
- port: 6379
86+
selector:
87+
app: azure-vote-back
88+
```
4289
4390
```bicep
44-
resource appsDeployment_azureVoteBack 'apps/Deployment@v1' = {}
45-
```
91+
resource appsDeployment_azureVoteBack 'apps/Deployment@v1' = {
92+
metadata: {
93+
name: 'azure-vote-back'
94+
}
95+
spec: {
96+
replicas: 1
97+
selector: {
98+
matchLabels: {
99+
app: 'azure-vote-back'
100+
}
101+
}
102+
template: {
103+
metadata: {
104+
labels: {
105+
app: 'azure-vote-back'
106+
}
107+
}
108+
spec: {
109+
nodeSelector: {
110+
'kubernetes.io/os': 'linux'
111+
}
112+
containers: [
113+
{
114+
name: 'azure-vote-back'
115+
image: 'mcr.microsoft.com/oss/bitnami/redis:6.0.8'
116+
env: [
117+
{
118+
name: 'ALLOW_EMPTY_PASSWORD'
119+
value: 'yes'
120+
}
121+
]
122+
resources: {
123+
requests: {
124+
cpu: '100m'
125+
memory: '128Mi'
126+
}
127+
limits: {
128+
cpu: '250m'
129+
memory: '256Mi'
130+
}
131+
}
132+
ports: [
133+
{
134+
containerPort: 6379
135+
name: 'redis'
136+
}
137+
]
138+
}
139+
]
140+
}
141+
}
142+
}
143+
}
46144

47-
- .apiVersion: Specifies the API group and API resource you want to use when creating the resource.
48-
- .kind: Specifies the type of resource you want to create.
145+
resource coreService_azureVoteBack 'core/Service@v1' = {
146+
metadata: {
147+
name: 'azure-vote-back'
148+
}
149+
spec: {
150+
ports: [
151+
{
152+
port: 6379
153+
}
154+
]
155+
selector: {
156+
app: 'azure-vote-back'
157+
}
158+
}
159+
}
160+
```
49161

50162
## Visual Studio Code import
51163

0 commit comments

Comments
 (0)